diff options
author | Torok Edwin <edwintorok@gmail.com> | 2008-10-27 10:18:45 +0000 |
---|---|---|
committer | Torok Edwin <edwintorok@gmail.com> | 2008-10-27 10:18:45 +0000 |
commit | 450ffd2f3e86f3c19d4b46b2eb2c5ba10ef01cdc (patch) | |
tree | 860893f4f671334fe5c5cae36ca83d9e5bf87b08 | |
parent | bb026a0c6323bbe994cff5be123c13e621e8ef54 (diff) | |
download | bcm5719-llvm-450ffd2f3e86f3c19d4b46b2eb2c5ba10ef01cdc.tar.gz bcm5719-llvm-450ffd2f3e86f3c19d4b46b2eb2c5ba10ef01cdc.zip |
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.
llvm-svn: 58240
-rw-r--r-- | llvm/lib/Analysis/LoopVR.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LoopVR.cpp b/llvm/lib/Analysis/LoopVR.cpp index 7f5de259caf..d0b77b89f0a 100644 --- a/llvm/lib/Analysis/LoopVR.cpp +++ b/llvm/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); |