From 36836a6eb20cca707b4c7db86d09c8dbc52e6490 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 10 Sep 2003 04:49:10 +0000 Subject: [PATCH] Simplify some code git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8426 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/InductionVariable.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/Analysis/InductionVariable.cpp b/lib/Analysis/InductionVariable.cpp index 3ac934e42b1..73e97a4a114 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(V) || isa(V) || isa(V)) - return true; - - const Instruction *I = cast(V); - const BasicBlock *BB = I->getParent(); - - return !L->contains(BB); + if (const Instruction *I = dyn_cast(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(Start)) if (const ConstantInt *CStep = dyn_cast(Step)) { - if (CStart->equalsInt(0) && CStep->equalsInt(1)) + if (CStart->isNullValue() && CStep->equalsInt(1)) return Cannonical; else return SimpleLinear;