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 | 36836a6eb20cca707b4c7db86d09c8dbc52e6490 (patch) | |
tree | 8d6dd62d05ac741b037562a7bce8b25e9912b97a /lib/Analysis/InductionVariable.cpp | |
parent | dfa5f83c8ea9fa577c5a42407c3fd8b6c789a6dd (diff) |
Simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/InductionVariable.cpp')
-rw-r--r-- | lib/Analysis/InductionVariable.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Analysis/InductionVariable.cpp b/lib/Analysis/InductionVariable.cpp index 3ac934e42b..73e97a4a11 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; |