diff options
author | Dan Gohman <gohman@apple.com> | 2010-03-09 23:46:50 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-03-09 23:46:50 +0000 |
commit | 69451a09500672a49ca3614137c6aca814920f90 (patch) | |
tree | 8d1ec3d9eb4bc3f13d26c42217c8bb7ebffef3aa /llvm/lib/Analysis | |
parent | 3d72a678de75806bf79e16b9e7dbd0ca5429c3c4 (diff) | |
download | bcm5719-llvm-69451a09500672a49ca3614137c6aca814920f90.tar.gz bcm5719-llvm-69451a09500672a49ca3614137c6aca814920f90.zip |
Avoid analyzing instructions in blocks not reachable from the entry block.
They are lots of trouble, and they don't matter. This fixes PR6559.
llvm-svn: 98103
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index b979f3328d4..15f072dbeb7 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -3101,9 +3101,16 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { return getUnknown(V); unsigned Opcode = Instruction::UserOp1; - if (Instruction *I = dyn_cast<Instruction>(V)) + if (Instruction *I = dyn_cast<Instruction>(V)) { Opcode = I->getOpcode(); - else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) + + // Don't attempt to analyze instructions in blocks that aren't + // reachable. Such instructions don't matter, and they aren't required + // to obey basic rules for definitions dominating uses which this + // analysis depends on. + if (!DT->isReachableFromEntry(I->getParent())) + return getUnknown(V); + } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) Opcode = CE->getOpcode(); else if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) return getConstant(CI); |