Remove an unncessary argument to SimplifySelectCC and add an additional
authorNate Begeman <natebegeman@mac.com>
Sat, 13 Aug 2005 06:14:17 +0000 (06:14 +0000)
committerNate Begeman <natebegeman@mac.com>
Sat, 13 Aug 2005 06:14:17 +0000 (06:14 +0000)
assert when creating a select_cc node.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22780 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAG.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index beb1cc9ff675fd53d21c84f7a18c39c02521598a..79e5014e46b7408d1bb845724d975ecab910af85 100644 (file)
@@ -222,9 +222,8 @@ private:
   /// SimplifySelectCC - Try to simplify a select_cc built with the specified
   /// operands and cc.  This can be used to simplify both the select_cc node,
   /// and a select node whose first operand is a setcc.
-  SDOperand SimplifySelectCC(MVT::ValueType VT, ISD::CondCode CC,
-                             SDOperand N1, SDOperand N2, SDOperand N3,
-                             SDOperand N4);
+  SDOperand SimplifySelectCC(SDOperand N1, SDOperand N2, SDOperand N3,
+                             SDOperand N4, ISD::CondCode CC);
     
   // Maps to auto-CSE operations.
   std::map<std::pair<unsigned, std::pair<SDOperand, MVT::ValueType> >,
index 9da30f1cf505a9f03d8339621550cd84702eb803..993b3ec2aa21e4aaeb16a172dc9982aa38ad6459 100644 (file)
@@ -686,9 +686,10 @@ SDOperand SelectionDAG::SimplifySetCC(MVT::ValueType VT, SDOperand N1,
   return SDOperand();
 }
 
-SDOperand SelectionDAG::SimplifySelectCC(MVT::ValueType VT, ISD::CondCode CC,
-                                    SDOperand N1, SDOperand N2, SDOperand N3,
-                                    SDOperand N4) {
+SDOperand SelectionDAG::SimplifySelectCC(SDOperand N1, SDOperand N2, 
+                                         SDOperand N3, SDOperand N4, 
+                                         ISD::CondCode CC) {
+  MVT::ValueType VT = N3.getValueType();
   ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N2.Val);
   ConstantSDNode *N3C = dyn_cast<ConstantSDNode>(N3.Val);
   ConstantSDNode *N4C = dyn_cast<ConstantSDNode>(N4.Val);
@@ -1490,9 +1491,8 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
         return getNode(ISD::AND, VT, N1, N2);
     }
     if (N1.getOpcode() == ISD::SETCC) {
-      SDOperand Simp = SimplifySelectCC(VT, 
-                                  cast<CondCodeSDNode>(N1.getOperand(2))->get(),
-                                  N1.getOperand(0), N1.getOperand(1), N2, N3);
+      SDOperand Simp = SimplifySelectCC(N1.getOperand(0), N1.getOperand(1), N2, 
+                             N3, cast<CondCodeSDNode>(N1.getOperand(2))->get());
       if (Simp.Val) return Simp;
     }
     break;
@@ -1541,8 +1541,10 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
            "LHS and RHS of condition must have same type!");
     assert(N3.getValueType() == N4.getValueType() &&
            "True and False arms of SelectCC must have same type!");
-    SDOperand Simp = SimplifySelectCC(VT, cast<CondCodeSDNode>(N5)->get(), N1, 
-                                      N2, N3, N4);
+    assert(N3.getValueType() == VT &&
+           "select_cc node must be of same type as true and false value!");
+    SDOperand Simp = SimplifySelectCC(N1, N2, N3, N4, 
+                                      cast<CondCodeSDNode>(N5)->get());
     if (Simp.Val) return Simp;
   }