mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-15 07:59:57 +00:00
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
This commit is contained in:
parent
f5305f9cc7
commit
8ed680cce3
@ -527,7 +527,8 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI) {
|
|||||||
PredicateBlock(TrueBBI, BBI.BrCond);
|
PredicateBlock(TrueBBI, BBI.BrCond);
|
||||||
|
|
||||||
// If 'true' block has a 'false' successor, add an exit branch to it.
|
// 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);
|
std::vector<MachineOperand> RevCond(TrueBBI.BrCond);
|
||||||
if (TII->ReverseBranchCondition(RevCond))
|
if (TII->ReverseBranchCondition(RevCond))
|
||||||
assert(false && "Unable to reverse branch condition!");
|
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'.
|
// predecessors. Otherwise, add a unconditional branch from 'true' to 'false'.
|
||||||
BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()];
|
BBInfo &FalseBBI = BBAnalysis[BBI.FalseBB->getNumber()];
|
||||||
bool FalseBBDead = false;
|
bool FalseBBDead = false;
|
||||||
if (FalseBBI.BB->pred_size() == 2) {
|
if (!HasEarlyExit && FalseBBI.BB->pred_size() == 2) {
|
||||||
MergeBlocks(TrueBBI, FalseBBI);
|
MergeBlocks(TrueBBI, FalseBBI);
|
||||||
FalseBBDead = true;
|
FalseBBDead = true;
|
||||||
} else if (!isNextBlock(TrueBBI.BB, FalseBBI.BB))
|
} else if (!isNextBlock(TrueBBI.BB, FalseBBI.BB))
|
||||||
|
Loading…
Reference in New Issue
Block a user