diff options
author | Chris Lattner <sabre@nondot.org> | 2005-04-09 03:30:29 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-04-09 03:30:29 +0000 |
commit | e7ccd4acd2ee9753e6d212efd522be5c7de154d7 (patch) | |
tree | 5f62e2a889dfe1ba48d0632f1fa6224f5279f233 /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
parent | 411e888c1b4155190c8cffe388631ee20693b309 (diff) |
Emit BRCONDTWOWAY when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 7c347d0526..bfceecb7aa 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -430,7 +430,6 @@ void SelectionDAGLowering::visitBr(BranchInst &I) { MachineBasicBlock *Succ1MBB = FuncInfo.MBBMap[I.getSuccessor(1)]; SDOperand Cond = getValue(I.getCondition()); - if (Succ1MBB == NextBlock) { // If the condition is false, fall through. This means we should branch // 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(), Cond, DAG.getBasicBlock(Succ1MBB))); } else { - // Neither edge is a fall through. If the comparison is true, jump to - // Succ#0, otherwise branch unconditionally to succ #1. - DAG.setRoot(DAG.getNode(ISD::BRCOND, MVT::Other, getRoot(), - Cond, DAG.getBasicBlock(Succ0MBB))); - DAG.setRoot(DAG.getNode(ISD::BR, MVT::Other, getRoot(), - DAG.getBasicBlock(Succ1MBB))); + std::vector<SDOperand> Ops; + Ops.push_back(getRoot()); + Ops.push_back(Cond); + Ops.push_back(DAG.getBasicBlock(Succ0MBB)); + Ops.push_back(DAG.getBasicBlock(Succ1MBB)); + DAG.setRoot(DAG.getNode(ISD::BRCONDTWOWAY, MVT::Other, Ops)); } } } |