summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-04-09 00:52:49 +0000
committerOwen Anderson <resistor@mac.com>2007-04-09 00:52:49 +0000
commitae39ca037a2f8de9e18f9601bb959436925aa160 (patch)
tree5bb57259be127b543fd0337858628013840754cf /llvm/lib/Transforms/Utils/LoopSimplify.cpp
parent0df53574361d9e43c4f5e31c64f457b7f0a4c9a6 (diff)
downloadbcm5719-llvm-ae39ca037a2f8de9e18f9601bb959436925aa160.tar.gz
bcm5719-llvm-ae39ca037a2f8de9e18f9601bb959436925aa160.zip
Cleanup some from my DomSet-removal changes. Add a new
isReachableFromEntry test to ETForest to factor a common test out of code. llvm-svn: 35786
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopSimplify.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 5319d18b1ca..ffdc91c37ab 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -312,6 +312,8 @@ BasicBlock *LoopSimplify::SplitBlockPredecessors(BasicBlock *BB,
// Can we eliminate this phi node now?
if (Value *V = PN->hasConstantValue(true)) {
Instruction *I = dyn_cast<Instruction>(V);
+ // If I is in NewBB, the ETForest call will fail, because NewBB isn't
+ // registered in ETForest yet. Handle this case explicitly.
if (!I || (I->getParent() != NewBB &&
getAnalysis<ETForest>().dominates(I, PN))) {
PN->replaceAllUsesWith(V);
@@ -701,15 +703,13 @@ void LoopSimplify::UpdateDomInfoForRevectoredPreds(BasicBlock *NewBB,
{
BasicBlock *OnePred = PredBlocks[0];
unsigned i = 1, e = PredBlocks.size();
- for (i = 1; !ETF.dominates(&OnePred->getParent()->getEntryBlock(), OnePred);
- ++i) {
+ for (i = 1; !ETF.isReachableFromEntry(OnePred); ++i) {
assert(i != e && "Didn't find reachable pred?");
OnePred = PredBlocks[i];
}
for (; i != e; ++i)
- if (PredBlocks[i] != OnePred &&
- ETF.dominates(&PredBlocks[i]->getParent()->getEntryBlock(), OnePred)){
+ if (PredBlocks[i] != OnePred && ETF.isReachableFromEntry(OnePred)){
NewBBDominatesNewBBSucc = false;
break;
}
OpenPOWER on IntegriCloud