eliminate uses of SelectionDAG::getBR2Way_CC
authorChris Lattner <sabre@nondot.org>
Sun, 29 Jan 2006 06:00:45 +0000 (06:00 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 29 Jan 2006 06:00:45 +0000 (06:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25767 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index a96c59b3400b08323821d474bb8f34bf8013fcc8..218e1305800be638a27c9b66474770c478e0adfd 100644 (file)
@@ -2092,9 +2092,16 @@ SDOperand DAGCombiner::visitBRTWOWAY_CC(SDNode *N) {
   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 7a3c506f4e58bc446312266830d01ed96178ac4d..f89b237c053fb5c0d9c96975334ef88570b66777 100644 (file)
@@ -749,14 +749,22 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
       // 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));