summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-06-05 01:31:40 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-06-05 01:31:40 +0000
commit6e4babe8ccaed528bca491329a80e530979f5118 (patch)
treec702c6a214cd68301da9db4bd99a5f6586f67468
parent17aad8164e07e4119090d0f2937497eb5715e872 (diff)
downloadbcm5719-llvm-6e4babe8ccaed528bca491329a80e530979f5118.tar.gz
bcm5719-llvm-6e4babe8ccaed528bca491329a80e530979f5118.zip
If the predicated block requires an early exit, end the block there and add a unconditional branch to false block. AnalyzeBranch() does not understand early exits.
llvm-svn: 37430
-rw-r--r--llvm/lib/CodeGen/IfConversion.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp
index bd50121f4b3..1023f8fd950 100644
--- a/llvm/lib/CodeGen/IfConversion.cpp
+++ b/llvm/lib/CodeGen/IfConversion.cpp
@@ -527,7 +527,8 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI) {
PredicateBlock(TrueBBI, BBI.BrCond);
// If 'true' block has a 'false' successor, add an exit branch to it.
- if (TrueBBI.FalseBB) {
+ bool HasEarlyExit = TrueBBI.FalseBB != NULL;
+ if (HasEarlyExit) {
std::vector<MachineOperand> RevCond(TrueBBI.BrCond);
if (TII->ReverseBranchCondition(RevCond))
assert(false && "Unable to reverse branch condition!");
@@ -538,7 +539,7 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI) {
// predecessors. Otherwise, add a unconditional branch from 'true' to 'false'.
BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()];
bool FalseBBDead = false;
- if (FalseBBI.BB->pred_size() == 2) {
+ if (!HasEarlyExit && FalseBBI.BB->pred_size() == 2) {
MergeBlocks(TrueBBI, FalseBBI);
FalseBBDead = true;
} else if (!isNextBlock(TrueBBI.BB, FalseBBI.BB))
OpenPOWER on IntegriCloud