mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-15 09:33:39 +00:00
Don't use PN->replaceUsesOfWith() to change a PHINode's incoming blocks,
because it won't work after my phi operand changes, because the incoming blocks will no longer be Uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133512 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
80be2a2654
commit
69254f67a5
@ -190,7 +190,9 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
|
|||||||
BasicBlock* exitingBlock = exitingBlocks[0];
|
BasicBlock* exitingBlock = exitingBlocks[0];
|
||||||
BasicBlock::iterator BI = exitBlock->begin();
|
BasicBlock::iterator BI = exitBlock->begin();
|
||||||
while (PHINode* P = dyn_cast<PHINode>(BI)) {
|
while (PHINode* P = dyn_cast<PHINode>(BI)) {
|
||||||
P->replaceUsesOfWith(exitingBlock, preheader);
|
int j = P->getBasicBlockIndex(exitingBlock);
|
||||||
|
assert(j >= 0 && "Can't find exiting block in exit block's phi node!");
|
||||||
|
P->setIncomingBlock(j, preheader);
|
||||||
for (unsigned i = 1; i < exitingBlocks.size(); ++i)
|
for (unsigned i = 1; i < exitingBlocks.size(); ++i)
|
||||||
P->removeIncomingValue(exitingBlocks[i]);
|
P->removeIncomingValue(exitingBlocks[i]);
|
||||||
++BI;
|
++BI;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user