mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
The IfConverter::MergeBlocks method appears to be used only to merge a basic
block with its unique predecessor. Change the code to assert if that is not the case, instead of trying to handle situations where the block has multiple predecessors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71744 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1187,15 +1187,10 @@ void IfConverter::MergeBlocks(BBInfo &ToBBI, BBInfo &FromBBI) {
|
|||||||
ToBBI.BB->splice(ToBBI.BB->end(),
|
ToBBI.BB->splice(ToBBI.BB->end(),
|
||||||
FromBBI.BB, FromBBI.BB->begin(), FromBBI.BB->end());
|
FromBBI.BB, FromBBI.BB->begin(), FromBBI.BB->end());
|
||||||
|
|
||||||
// Redirect all branches to FromBB to ToBB.
|
// This only works when FromBBI has no predecessors except ToBBI.
|
||||||
std::vector<MachineBasicBlock *> Preds(FromBBI.BB->pred_begin(),
|
assert(FromBBI.BB->pred_size() == 1 &&
|
||||||
FromBBI.BB->pred_end());
|
*FromBBI.BB->pred_begin() == ToBBI.BB &&
|
||||||
for (unsigned i = 0, e = Preds.size(); i != e; ++i) {
|
"if-converter not merging block into its unique predecessor");
|
||||||
MachineBasicBlock *Pred = Preds[i];
|
|
||||||
if (Pred == ToBBI.BB)
|
|
||||||
continue;
|
|
||||||
Pred->ReplaceUsesOfBlockWith(FromBBI.BB, ToBBI.BB);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<MachineBasicBlock *> Succs(FromBBI.BB->succ_begin(),
|
std::vector<MachineBasicBlock *> Succs(FromBBI.BB->succ_begin(),
|
||||||
FromBBI.BB->succ_end());
|
FromBBI.BB->succ_end());
|
||||||
|
Reference in New Issue
Block a user