[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri May 20 15:20:05 PDT 2005
Changes in directory llvm/lib/Transforms/Utils:
SimplifyCFG.cpp updated: 1.70 -> 1.71
---
Log message:
Fix Transforms/SimplifyCFG/switch-simplify-crash.ll
---
Diffs of the changes: (+7 -0)
SimplifyCFG.cpp | 7 +++++++
1 files changed, 7 insertions(+)
Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.70 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.71
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.70 Sat May 14 07:21:56 2005
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Fri May 20 17:19:54 2005
@@ -1236,6 +1236,7 @@
} else if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {
for (unsigned i = 1, e = SI->getNumCases(); i != e; ++i)
if (SI->getSuccessor(i) == BB) {
+ BB->removePredecessor(SI->getParent());
SI->removeCase(i);
--i; --e;
Changed = true;
@@ -1263,6 +1264,12 @@
SI->setSuccessor(0, MaxBlock);
Changed = true;
+ // If MaxBlock has phinodes in it, remove MaxPop-1 entries from
+ // it.
+ if (isa<PHINode>(MaxBlock->begin()))
+ for (unsigned i = 0; i != MaxPop-1; ++i)
+ MaxBlock->removePredecessor(SI->getParent());
+
for (unsigned i = 1, e = SI->getNumCases(); i != e; ++i)
if (SI->getSuccessor(i) == MaxBlock) {
SI->removeCase(i);
More information about the llvm-commits
mailing list