mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
[SwitchLowering] Remove incoming values in the reverse order
- To prevent invalidating *successive* indices. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232510 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -175,11 +175,16 @@ static void fixPhis(BasicBlock *SuccBB, BasicBlock *OrigBB, BasicBlock *NewBB,
|
||||
|
||||
// Remove additional occurences coming from condensed cases and keep the
|
||||
// number of incoming values equal to the number of branches to SuccBB.
|
||||
SmallVector<unsigned, 8> Indices;
|
||||
for (++Idx; LocalNumMergedCases > 0 && Idx < E; ++Idx)
|
||||
if (PN->getIncomingBlock(Idx) == OrigBB) {
|
||||
PN->removeIncomingValue(Idx);
|
||||
Indices.push_back(Idx);
|
||||
LocalNumMergedCases--;
|
||||
}
|
||||
// Remove incoming values in the reverse order to prevent invalidating
|
||||
// *successive* index.
|
||||
for (auto III = Indices.rbegin(), IIE = Indices.rend(); III != IIE; ++III)
|
||||
PN->removeIncomingValue(*III);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user