[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
Owen Anderson
resistor at mac.com
Tue Jun 27 15:26:21 PDT 2006
Changes in directory llvm/lib/Transforms/Scalar:
LoopUnswitch.cpp updated: 1.41 -> 1.42
---
Log message:
Fix for 2006-06-27-DeadSwitchCase.ll
Be more careful when updating Phi nodes after eliminating dead switch cases. Fix
proposed by Chris.
---
Diffs of the changes: (+6 -5)
LoopUnswitch.cpp | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.41 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.42
--- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.41 Mon Jun 26 02:44:36 2006
+++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Jun 27 17:26:09 2006
@@ -971,11 +971,12 @@
Old->getTerminator()->eraseFromParent();
- for (BasicBlock::iterator II = SI->getSuccessor(i)->begin(),
- IE = SI->getSuccessor(i)->end(); II != IE; ++II) {
- if (isa<PHINode>(*II)) {
- (*II).replaceUsesOfWith(Split, Old);
- }
+
+ PHINode *PN;
+ for (BasicBlock::iterator II = SI->getSuccessor(i)->begin();
+ (PN = dyn_cast<PHINode>(II)); ++II) {
+ Value *InVal = PN->removeIncomingValue(Split, false);
+ PN->addIncoming(InVal, Old);
}
SI->removeCase(i);
More information about the llvm-commits
mailing list