[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp LegalizeDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Jan 28 22:00:57 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.87 -> 1.88
LegalizeDAG.cpp updated: 1.289 -> 1.290
---
Log message:

eliminate uses of SelectionDAG::getBR2Way_CC


---
Diffs of the changes:  (+24 -9)

 DAGCombiner.cpp |   13 ++++++++++---
 LegalizeDAG.cpp |   20 ++++++++++++++------
 2 files changed, 24 insertions(+), 9 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.87 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.88
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.87	Fri Jan 27 19:06:30 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Sun Jan 29 00:00:45 2006
@@ -2092,9 +2092,16 @@
   if (SCCC && SCCC->isNullValue())
     return DAG.getNode(ISD::BR, MVT::Other, Chain, N5);
   // fold to a simpler setcc
-  if (SCC.Val && SCC.getOpcode() == ISD::SETCC)
-    return DAG.getBR2Way_CC(Chain, SCC.getOperand(2), SCC.getOperand(0), 
-                            SCC.getOperand(1), N4, N5);
+  if (SCC.Val && SCC.getOpcode() == ISD::SETCC) {
+    std::vector<SDOperand> Ops;
+    Ops.push_back(Chain);
+    Ops.push_back(SCC.getOperand(2));
+    Ops.push_back(SCC.getOperand(0));
+    Ops.push_back(SCC.getOperand(1));
+    Ops.push_back(N4);
+    Ops.push_back(N5);
+    return DAG.getNode(ISD::BRTWOWAY_CC, MVT::Other, Ops);
+  }
   return SDOperand();
 }
 


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.289 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.290
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.289	Sat Jan 28 04:58:55 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Sun Jan 29 00:00:45 2006
@@ -749,14 +749,22 @@
       // BRCOND/BR pair.
       if (TLI.isOperationLegal(ISD::BRTWOWAY_CC, MVT::Other)) {
         if (Tmp2.getOpcode() == ISD::SETCC) {
-          Result = DAG.getBR2Way_CC(Tmp1, Tmp2.getOperand(2),
-                                    Tmp2.getOperand(0), Tmp2.getOperand(1),
-                                    Node->getOperand(2), Node->getOperand(3));
+          Tmp3 = Tmp2.getOperand(0);
+          Tmp4 = Tmp2.getOperand(1);
+          Tmp2 = Tmp2.getOperand(2);
         } else {
-          Result = DAG.getBR2Way_CC(Tmp1, DAG.getCondCode(ISD::SETNE), Tmp2, 
-                                    DAG.getConstant(0, Tmp2.getValueType()),
-                                    Node->getOperand(2), Node->getOperand(3));
+          Tmp3 = Tmp2;
+          Tmp4 = DAG.getConstant(0, Tmp2.getValueType());
+          Tmp2 = DAG.getCondCode(ISD::SETNE);
         }
+        std::vector<SDOperand> Ops;
+        Ops.push_back(Tmp1);
+        Ops.push_back(Tmp2);
+        Ops.push_back(Tmp3);
+        Ops.push_back(Tmp4);
+        Ops.push_back(Node->getOperand(2));
+        Ops.push_back(Node->getOperand(3));
+        Result = DAG.getNode(ISD::BRTWOWAY_CC, MVT::Other, Ops);
       } else {
         Result = DAG.getNode(ISD::BRCOND, MVT::Other, Tmp1, Tmp2,
                              Node->getOperand(2));






More information about the llvm-commits mailing list