summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-04-25 22:53:27 +0000
committerChris Lattner <sabre@nondot.org>2003-04-25 22:53:27 +0000
commitb68a34eb3fe6817f9e1a745f1795a38fd48afb52 (patch)
tree70abad484a4ece1022ac9e52aec5855b1e43c762 /llvm/lib/Transforms
parentb093bf312f081a491dadb96f8b47dc14d73ade5e (diff)
downloadbcm5719-llvm-b68a34eb3fe6817f9e1a745f1795a38fd48afb52.tar.gz
bcm5719-llvm-b68a34eb3fe6817f9e1a745f1795a38fd48afb52.zip
Fix bug: ADCE/2003-04-25-PHIPostDominateProblem.ll
llvm-svn: 5952
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/ADCE.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp
index 5e2a2755fb7..f7a68e48f8c 100644
--- a/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -310,15 +310,16 @@ bool ADCE::doADCE() {
// should be identical to the incoming values for LastDead.
//
for (BasicBlock::iterator II = NextAlive->begin();
- PHINode *PN = dyn_cast<PHINode>(II); ++II) {
- // Get the incoming value for LastDead...
- int OldIdx = PN->getBasicBlockIndex(LastDead);
- assert(OldIdx != -1 && "LastDead is not a pred of NextAlive!");
- Value *InVal = PN->getIncomingValue(OldIdx);
-
- // Add an incoming value for BB now...
- PN->addIncoming(InVal, BB);
- }
+ PHINode *PN = dyn_cast<PHINode>(II); ++II)
+ if (LiveSet.count(PN)) { // Only modify live phi nodes
+ // Get the incoming value for LastDead...
+ int OldIdx = PN->getBasicBlockIndex(LastDead);
+ assert(OldIdx != -1 &&"LastDead is not a pred of NextAlive!");
+ Value *InVal = PN->getIncomingValue(OldIdx);
+
+ // Add an incoming value for BB now...
+ PN->addIncoming(InVal, BB);
+ }
}
}
OpenPOWER on IntegriCloud