mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-11 15:26:07 +00:00
SDISel should not optimize a unconditional branch following a conditional branch
when the unconditional branch destination is the fallthrough block. The canonicalization makes it easier to allow optimizations on DAGs to invert conditional branches. The branch folding pass (and AnalyzeBranch) will clean up the unnecessary unconditional branches later. This is one of the patches leading up to disabling codegen prepare critical edge splitting. llvm-svn: 114630
This commit is contained in:
parent
f670bff621
commit
3866797d9a
@ -1503,10 +1503,11 @@ void SelectionDAGBuilder::visitSwitchCase(CaseBlock &CB,
|
||||
MVT::Other, getControlRoot(), Cond,
|
||||
DAG.getBasicBlock(CB.TrueBB));
|
||||
|
||||
// Insert the false branch.
|
||||
if (CB.FalseBB != NextBlock)
|
||||
BrCond = DAG.getNode(ISD::BR, dl, MVT::Other, BrCond,
|
||||
DAG.getBasicBlock(CB.FalseBB));
|
||||
// Insert the false branch. Do this even if it's a fall through branch,
|
||||
// this makes it easier to do DAG optimizations which require inverting
|
||||
// the branch condition.
|
||||
BrCond = DAG.getNode(ISD::BR, dl, MVT::Other, BrCond,
|
||||
DAG.getBasicBlock(CB.FalseBB));
|
||||
|
||||
DAG.setRoot(BrCond);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user