mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-12 13:24:29 +00:00
Emit BRCONDTWOWAY when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21167 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -430,7 +430,6 @@ void SelectionDAGLowering::visitBr(BranchInst &I) {
|
|||||||
MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)];
|
MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)];
|
||||||
|
|
||||||
SDOperand Cond = getValue(I.getCondition());
|
SDOperand Cond = getValue(I.getCondition());
|
||||||
|
|
||||||
if (Succ1MBB == NextBlock) {
|
if (Succ1MBB == NextBlock) {
|
||||||
// If the condition is false, fall through. This means we should branch
|
// If the condition is false, fall through. This means we should branch
|
||||||
// if the condition is true to Succ #0.
|
// if the condition is true to Succ #0.
|
||||||
@ -444,12 +443,12 @@ void SelectionDAGLowering::visitBr(BranchInst &I) {
|
|||||||
DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(),
|
DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(),
|
||||||
Cond, DAG.getBasicBlock(Succ1MBB)));
|
Cond, DAG.getBasicBlock(Succ1MBB)));
|
||||||
} else {
|
} else {
|
||||||
// Neither edge is a fall through. If the comparison is true, jump to
|
std::vector<SDOperand> Ops;
|
||||||
// Succ#0, otherwise branch unconditionally to succ #1.
|
Ops.push_back(getRoot());
|
||||||
DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(),
|
Ops.push_back(Cond);
|
||||||
Cond, DAG.getBasicBlock(Succ0MBB)));
|
Ops.push_back(DAG.getBasicBlock(Succ0MBB));
|
||||||
DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, getRoot(),
|
Ops.push_back(DAG.getBasicBlock(Succ1MBB));
|
||||||
DAG.getBasicBlock(Succ1MBB)));
|
DAG.setRoot(DAG.getNode(ISD::BRCONDTWOWAY, MVT::Other, Ops));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user