aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/LoopVR.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/LoopVR.cpp')
-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 7f5de259ca..d0b77b89f0 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);