summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-04-09 03:30:29 +0000
committerChris Lattner <sabre@nondot.org>2005-04-09 03:30:29 +0000
commit8a98c7f337094a59b711dd9fc8212057940e5e37 (patch)
treec362419b50856596d78b62e839a94bc9a451a3fe /llvm/lib/CodeGen
parentfd98678a8a4f66ec3751cd086375a18a754b4c45 (diff)
downloadbcm5719-llvm-8a98c7f337094a59b711dd9fc8212057940e5e37.tar.gz
bcm5719-llvm-8a98c7f337094a59b711dd9fc8212057940e5e37.zip
Emit BRCONDTWOWAY when possible.
llvm-svn: 21167
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 7c347d0526a..bfceecb7aaf 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/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));
}
}
}
OpenPOWER on IntegriCloud