Simplify some code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8426 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-09-10 04:49:10 +00:00
parent dfa5f83c8e
commit 36836a6eb2

View File

@ -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;