aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-09-10 04:49:10 +0000
committerChris Lattner <sabre@nondot.org>2003-09-10 04:49:10 +0000
commit36836a6eb20cca707b4c7db86d09c8dbc52e6490 (patch)
tree8d6dd62d05ac741b037562a7bce8b25e9912b97a /lib
parentdfa5f83c8ea9fa577c5a42407c3fd8b6c789a6dd (diff)
downloadexternal_llvm-36836a6eb20cca707b4c7db86d09c8dbc52e6490.zip
external_llvm-36836a6eb20cca707b4c7db86d09c8dbc52e6490.tar.gz
external_llvm-36836a6eb20cca707b4c7db86d09c8dbc52e6490.tar.bz2
Simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/InductionVariable.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Analysis/InductionVariable.cpp b/lib/Analysis/InductionVariable.cpp
index 3ac934e..73e97a4 100644
--- a/lib/Analysis/InductionVariable.cpp
+++ b/lib/Analysis/InductionVariable.cpp
@@ -30,13 +30,10 @@
#include "Support/Debug.h"
static bool isLoopInvariant(const Value *V, const Loop *L) {
- if (isa<Constant>(V) || isa<Argument>(V) || isa<GlobalValue>(V))
- return true;
-
- const Instruction *I = cast<Instruction>(V);
- const BasicBlock *BB = I->getParent();
-
- return !L->contains(BB);
+ if (const Instruction *I = dyn_cast<Instruction>(V))
+ return !L->contains(I->getParent());
+ // non-instructions all dominate instructions/blocks
+ return true;
}
enum InductionVariable::iType
@@ -45,7 +42,7 @@ InductionVariable::Classify(const Value *Start, const Value *Step,
// Check for cannonical and simple linear expressions now...
if (const ConstantInt *CStart = dyn_cast<ConstantInt>(Start))
if (const ConstantInt *CStep = dyn_cast<ConstantInt>(Step)) {
- if (CStart->equalsInt(0) && CStep->equalsInt(1))
+ if (CStart->isNullValue() && CStep->equalsInt(1))
return Cannonical;
else
return SimpleLinear;