diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-06-05 01:31:40 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-06-05 01:31:40 +0000 |
commit | 8ed680cce3d0cff361f352abce75a917093f0656 (patch) | |
tree | 7902583bf12479dad9485c47918cc83a6f6ba575 /lib/CodeGen/IfConversion.cpp | |
parent | f5305f9cc767ac18c258b03425c2c26345003acc (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37430 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/IfConversion.cpp')
-rw-r--r-- | lib/CodeGen/IfConversion.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index bd50121f4b..1023f8fd95 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/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)) |