diff options
author | Bob Wilson <bob.wilson@apple.com> | 2009-05-14 18:08:41 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2009-05-14 18:08:41 +0000 |
commit | 4bb3374b6d11a8a4ec1b174f0404bd6cbd2d00b9 (patch) | |
tree | aec362d0c89ee34d63c16393cb65f86505557a3c /lib | |
parent | bae7d6dbeb842b5ed051c50a87bc282f2dec6e1f (diff) | |
download | external_llvm-4bb3374b6d11a8a4ec1b174f0404bd6cbd2d00b9.zip external_llvm-4bb3374b6d11a8a4ec1b174f0404bd6cbd2d00b9.tar.gz external_llvm-4bb3374b6d11a8a4ec1b174f0404bd6cbd2d00b9.tar.bz2 |
Revert r71744. I must not have understood this correctly, because the
assertion is failing for some tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/IfConversion.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index 3cb3f74..1d0887f 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/lib/CodeGen/IfConversion.cpp @@ -1187,10 +1187,15 @@ void IfConverter::MergeBlocks(BBInfo &ToBBI, BBInfo &FromBBI) { ToBBI.BB->splice(ToBBI.BB->end(), FromBBI.BB, FromBBI.BB->begin(), FromBBI.BB->end()); - // 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"); + // 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); + } std::vector<MachineBasicBlock *> Succs(FromBBI.BB->succ_begin(), FromBBI.BB->succ_end()); |