aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-05-22 16:07:20 +0000
committerChris Lattner <sabre@nondot.org>2002-05-22 16:07:20 +0000
commit7f9412b50d56a3e984ba03463251b37c42c2a111 (patch)
tree986d3672119d0224684ad6ea1470a4c6d2722789 /lib
parentbec7dcad1425c767ecbbcde917182119c488c586 (diff)
downloadexternal_llvm-7f9412b50d56a3e984ba03463251b37c42c2a111.zip
external_llvm-7f9412b50d56a3e984ba03463251b37c42c2a111.tar.gz
external_llvm-7f9412b50d56a3e984ba03463251b37c42c2a111.tar.bz2
Fix bug: test/Regression/Transforms/SCCP/2002-05-21-InvalidSimplify.ll
Improperly handling edges... by not marking them alive properly git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2707 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 24d383b..591c22e 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -176,16 +176,6 @@ private:
DEBUG_SCCP(cerr << "Marking BB Executable: " << BB);
BBExecutable.insert(BB); // Basic block is executable!
BBWorkList.push_back(BB); // Add the block to the work list!
-
- // Visit all of the PHI nodes that merge values from this block... Because
- // this block is newly executable, PHI nodes that used to be constant now
- // may not be. Note that we only mark PHI nodes that live in blocks that
- // can execute!
- //
- for (Value::use_iterator I = BB->use_begin(), E = BB->use_end(); I != E;++I)
- if (PHINode *PN = dyn_cast<PHINode>(*I))
- if (BBExecutable.count(PN->getParent()))
- visitPHINode(PN);
}
@@ -487,8 +477,18 @@ void SCCP::visitTerminatorInst(TerminatorInst *TI) {
// Mark all feasible successors executable...
for (unsigned i = 0, e = SuccFeasible.size(); i != e; ++i)
- if (SuccFeasible[i])
- markExecutable(TI->getSuccessor(i));
+ if (SuccFeasible[i]) {
+ BasicBlock *Succ = TI->getSuccessor(i);
+ markExecutable(Succ);
+
+ // Visit all of the PHI nodes that merge values from this block...
+ // Because this edge may be new executable, and PHI nodes that used to be
+ // constant now may not be.
+ //
+ for (BasicBlock::iterator I = Succ->begin();
+ PHINode *PN = dyn_cast<PHINode>(*I); ++I)
+ visitPHINode(PN);
+ }
}
void SCCP::visitUnaryOperator(Instruction *I) {