diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-05-13 23:54:13 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-05-13 23:54:13 +0000 |
commit | b4c93b1ff7468a76b3a350a29ea8d91a95210bf0 (patch) | |
tree | d5581cbfc94ae10efcf13e015942ec1d034d5425 /llvm/lib/CodeGen/IfConversion.cpp | |
parent | 4f915313edb04fc4544cb6cc5bcf10476a787707 (diff) | |
download | bcm5719-llvm-b4c93b1ff7468a76b3a350a29ea8d91a95210bf0.tar.gz bcm5719-llvm-b4c93b1ff7468a76b3a350a29ea8d91a95210bf0.zip |
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.
llvm-svn: 71744
Diffstat (limited to 'llvm/lib/CodeGen/IfConversion.cpp')
-rw-r--r-- | llvm/lib/CodeGen/IfConversion.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp index 1d0887f843d..3cb3f74bb13 100644 --- a/llvm/lib/CodeGen/IfConversion.cpp +++ b/llvm/lib/CodeGen/IfConversion.cpp @@ -1187,15 +1187,10 @@ void IfConverter::MergeBlocks(BBInfo &ToBBI, BBInfo &FromBBI) { ToBBI.BB->splice(ToBBI.BB->end(), FromBBI.BB, FromBBI.BB->begin(), FromBBI.BB->end()); - // Redirect all branches to FromBB to ToBB. - std::vector<MachineBasicBlock *> Preds(FromBBI.BB->pred_begin(), - FromBBI.BB->pred_end()); - for (unsigned i = 0, e = Preds.size(); i != e; ++i) { - MachineBasicBlock *Pred = Preds[i]; - if (Pred == ToBBI.BB) - continue; - Pred->ReplaceUsesOfBlockWith(FromBBI.BB, ToBBI.BB); - } + // This only works when FromBBI has no predecessors except ToBBI. + assert(FromBBI.BB->pred_size() == 1 && + *FromBBI.BB->pred_begin() == ToBBI.BB && + "if-converter not merging block into its unique predecessor"); std::vector<MachineBasicBlock *> Succs(FromBBI.BB->succ_begin(), FromBBI.BB->succ_end()); |