diff options
author | Chris Lattner <sabre@nondot.org> | 2003-09-10 04:49:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-09-10 04:49:10 +0000 |
commit | 42e7abceb5f34778c4c63abcc9d9c4e8462e3357 (patch) | |
tree | 8c65cb97b181f60fffb78c92cd1c1cf2d5b992d6 /llvm/lib/Analysis | |
parent | 4ace48e0cac48774db4227ea656cf5fdcf589779 (diff) | |
download | bcm5719-llvm-42e7abceb5f34778c4c63abcc9d9c4e8462e3357.tar.gz bcm5719-llvm-42e7abceb5f34778c4c63abcc9d9c4e8462e3357.zip |
Simplify some code
llvm-svn: 8426
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/InductionVariable.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/InductionVariable.cpp b/llvm/lib/Analysis/InductionVariable.cpp index 3ac934e42b1..73e97a4a114 100644 --- a/llvm/lib/Analysis/InductionVariable.cpp +++ b/llvm/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; |