aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/IfConversion.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2009-05-13 23:48:58 +0000
committerBob Wilson <bob.wilson@apple.com>2009-05-13 23:48:58 +0000
commit8308e8fae0dad2dff22f0cedbfb5e1be3a146375 (patch)
tree20b5c34da6ab5f6f545973a7718fe7742cb057b4 /lib/CodeGen/IfConversion.cpp
parent596e22e2b3a1375bad678eb1c5e95b3188a0532b (diff)
downloadexternal_llvm-8308e8fae0dad2dff22f0cedbfb5e1be3a146375.zip
external_llvm-8308e8fae0dad2dff22f0cedbfb5e1be3a146375.tar.gz
external_llvm-8308e8fae0dad2dff22f0cedbfb5e1be3a146375.tar.bz2
Revert a portion of Dan's change r71018 that I'm convinced is wrong.
Dan was trying to catch the case where a basic block ends with a conditional branch to the fall-through block. In this case, all the instructions have been moved out of FromBBI, leaving it empty. It cannot end with a conditional branch. As the existing comment indicates, it will always fall through to the next block. If the block already had the next block (NBB) listed as a successor, the preceding loop has a check for that and does not remove it. Thus, we need to check and add the successor only when it is not already listed. With Dan's change, the empty block often ends up with the fall-through successor listed twice. This exposed the problem in pr4195, where CodePlacementOpt did not handle the same predecessor listed more than once. It is also at least partially responsible for pr4202 and probably a similar issue with Thumb branches being out of range. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71742 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
-rw-r--r--lib/CodeGen/IfConversion.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp
index 93e7ff6..1d0887f 100644
--- a/lib/CodeGen/IfConversion.cpp
+++ b/lib/CodeGen/IfConversion.cpp
@@ -1212,7 +1212,7 @@ void IfConverter::MergeBlocks(BBInfo &ToBBI, BBInfo &FromBBI) {
}
// Now FromBBI always falls through to the next block!
- if (NBB)
+ if (NBB && !FromBBI.BB->isSuccessor(NBB))
FromBBI.BB->addSuccessor(NBB);
std::copy(FromBBI.Predicate.begin(), FromBBI.Predicate.end(),