Know some identities about tokenfactor nodes.
authorChris Lattner <sabre@nondot.org>
Wed, 19 Jan 2005 18:01:40 +0000 (18:01 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 19 Jan 2005 18:01:40 +0000 (18:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19699 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 3b106d192d13c45f34b60c9f399f85361b87b5e2..762061fa0c7795c7c8a3de0ac4d22e8a51a66695 100644 (file)
@@ -549,6 +549,10 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
                                 SDOperand N1, SDOperand N2) {
 #ifndef NDEBUG
   switch (Opcode) {
+  case ISD::TokenFactor:
+    assert(VT == MVT::Other && N1.getValueType() == MVT::Other &&
+           N2.getValueType() == MVT::Other && "Invalid token factor!");
+    break;
   case ISD::AND:
   case ISD::OR:
   case ISD::XOR:
@@ -739,6 +743,13 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
 
   // Finally, fold operations that do not require constants.
   switch (Opcode) {
+  case ISD::TokenFactor:
+    if (N1.getOpcode() == ISD::EntryToken)
+      return N2;
+    if (N2.getOpcode() == ISD::EntryToken)
+      return N1;
+    break;
+
   case ISD::AND:
   case ISD::OR:
     if (SetCCSDNode *LHS = dyn_cast<SetCCSDNode>(N1.Val))