mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-21 16:31:16 +00:00
Simplify this code; switch lowering shouldn't produce cases
which trivially fold away. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106765 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2ea09e0546
commit
deca052d9d
@ -1424,18 +1424,10 @@ void SelectionDAGBuilder::visitSwitchCase(CaseBlock &CB,
|
|||||||
MVT::Other, getControlRoot(), Cond,
|
MVT::Other, getControlRoot(), Cond,
|
||||||
DAG.getBasicBlock(CB.TrueBB));
|
DAG.getBasicBlock(CB.TrueBB));
|
||||||
|
|
||||||
// If the branch was constant folded, fix up the CFG.
|
// Insert the false branch.
|
||||||
if (BrCond.getOpcode() == ISD::BR) {
|
|
||||||
SwitchBB->removeSuccessor(CB.FalseBB);
|
|
||||||
} else {
|
|
||||||
// Otherwise, go ahead and insert the false branch.
|
|
||||||
if (BrCond == getControlRoot())
|
|
||||||
SwitchBB->removeSuccessor(CB.TrueBB);
|
|
||||||
|
|
||||||
if (CB.FalseBB != NextBlock)
|
if (CB.FalseBB != NextBlock)
|
||||||
BrCond = DAG.getNode(ISD::BR, dl, MVT::Other, BrCond,
|
BrCond = DAG.getNode(ISD::BR, dl, MVT::Other, BrCond,
|
||||||
DAG.getBasicBlock(CB.FalseBB));
|
DAG.getBasicBlock(CB.FalseBB));
|
||||||
}
|
|
||||||
|
|
||||||
DAG.setRoot(BrCond);
|
DAG.setRoot(BrCond);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user