aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2008-10-27 10:18:45 +0000
committerTorok Edwin <edwintorok@gmail.com>2008-10-27 10:18:45 +0000
commitc83889ad906b130f39ba8f776111e51439c2a7ac (patch)
tree0e6ffc443701268bf77529933f4e47b19f3b7333 /lib
parent6f038f4140615380e493dc6a7cff42b0f3061301 (diff)
downloadexternal_llvm-c83889ad906b130f39ba8f776111e51439c2a7ac.zip
external_llvm-c83889ad906b130f39ba8f776111e51439c2a7ac.tar.gz
external_llvm-c83889ad906b130f39ba8f776111e51439c2a7ac.tar.bz2
Avoid crashing if instruction is not part of a loop.
If it is not part of a loop it is obviously invariant wrt to all loops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/LoopVR.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Analysis/LoopVR.cpp b/lib/Analysis/LoopVR.cpp
index 7f5de25..d0b77b89 100644
--- a/lib/Analysis/LoopVR.cpp
+++ b/lib/Analysis/LoopVR.cpp
@@ -247,12 +247,13 @@ ConstantRange LoopVR::compute(Value *V) {
return ConstantRange(cast<IntegerType>(V->getType())->getBitWidth(), false);
LoopInfo &LI = getAnalysis<LoopInfo>();
- ScalarEvolution &SE = getAnalysis<ScalarEvolution>();
Loop *L = LI.getLoopFor(I->getParent());
- if (L->isLoopInvariant(I))
+ if (!L || L->isLoopInvariant(I))
return ConstantRange(cast<IntegerType>(V->getType())->getBitWidth(), false);
+ ScalarEvolution &SE = getAnalysis<ScalarEvolution>();
+
SCEVHandle S = SE.getSCEV(I);
if (isa<SCEVUnknown>(S) || isa<SCEVCouldNotCompute>(S))
return ConstantRange(cast<IntegerType>(V->getType())->getBitWidth(), false);