mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 04:29:21 +00:00
Fix a bug that occurred when removing the last predecessor INTO an
infinite loop git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5953 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
619f825640
commit
02a78cf7ea
@ -186,7 +186,11 @@ void BasicBlock::removePredecessor(BasicBlock *Pred) {
|
||||
|
||||
// If the PHI _HAD_ two uses, replace PHI node with its now *single* value
|
||||
if (max_idx == 2) {
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user