mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-07 16:54:48 +00:00
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
This commit is contained in:
parent
6f038f4140
commit
c83889ad90
@ -247,12 +247,13 @@ ConstantRange LoopVR::compute(Value *V) {
|
|||||||
return ConstantRange(cast<IntegerType>(V->getType())->getBitWidth(), false);
|
return ConstantRange(cast<IntegerType>(V->getType())->getBitWidth(), false);
|
||||||
|
|
||||||
LoopInfo &LI = getAnalysis<LoopInfo>();
|
LoopInfo &LI = getAnalysis<LoopInfo>();
|
||||||
ScalarEvolution &SE = getAnalysis<ScalarEvolution>();
|
|
||||||
|
|
||||||
Loop *L = LI.getLoopFor(I->getParent());
|
Loop *L = LI.getLoopFor(I->getParent());
|
||||||
if (L->isLoopInvariant(I))
|
if (!L || L->isLoopInvariant(I))
|
||||||
return ConstantRange(cast<IntegerType>(V->getType())->getBitWidth(), false);
|
return ConstantRange(cast<IntegerType>(V->getType())->getBitWidth(), false);
|
||||||
|
|
||||||
|
ScalarEvolution &SE = getAnalysis<ScalarEvolution>();
|
||||||
|
|
||||||
SCEVHandle S = SE.getSCEV(I);
|
SCEVHandle S = SE.getSCEV(I);
|
||||||
if (isa<SCEVUnknown>(S) || isa<SCEVCouldNotCompute>(S))
|
if (isa<SCEVUnknown>(S) || isa<SCEVCouldNotCompute>(S))
|
||||||
return ConstantRange(cast<IntegerType>(V->getType())->getBitWidth(), false);
|
return ConstantRange(cast<IntegerType>(V->getType())->getBitWidth(), false);
|
||||||
|
Loading…
Reference in New Issue
Block a user