[llvm-commits] CVS: llvm/lib/VMCore/BasicBlock.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Apr 25 18:15:01 PDT 2003
Changes in directory llvm/lib/VMCore:
BasicBlock.cpp updated: 1.30 -> 1.31
---
Log message:
Fix a bug that occurred when removing the last predecessor INTO an
infinite loop
---
Diffs of the changes:
Index: llvm/lib/VMCore/BasicBlock.cpp
diff -u llvm/lib/VMCore/BasicBlock.cpp:1.30 llvm/lib/VMCore/BasicBlock.cpp:1.31
--- llvm/lib/VMCore/BasicBlock.cpp:1.30 Wed Apr 23 11:37:45 2003
+++ llvm/lib/VMCore/BasicBlock.cpp Fri Apr 25 18:14:19 2003
@@ -186,7 +186,11 @@
// If the PHI _HAD_ two uses, replace PHI node with its now *single* value
if (max_idx == 2) {
- PN->replaceAllUsesWith(PN->getOperand(0));
+ if (PN->getOperand(0) != PN)
+ PN->replaceAllUsesWith(PN->getOperand(0));
+ else
+ // We are left with an infinite loop with no entries: kill the PHI.
+ PN->replaceAllUsesWith(Constant::getNullValue(PN->getType()));
getInstList().pop_front(); // Remove the PHI node
}
More information about the llvm-commits
mailing list