fold noop vbitconvert instructions
authorChris Lattner <sabre@nondot.org>
Thu, 12 Apr 2007 05:58:43 +0000 (05:58 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 12 Apr 2007 05:58:43 +0000 (05:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35943 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index a51f79f592bd76e933ba0fef0d42948915aa0df7..7c8a94eaf5e70bbc18eb1a92c421509bc8f616c6 100644 (file)
@@ -1484,6 +1484,15 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
            MVT::getVectorNumElements(VT) == N3.getNumOperands() &&
            "Illegal VECTOR_SHUFFLE node!");
     break;
+  case ISD::VBIT_CONVERT:
+    // Fold vbit_convert nodes from a type to themselves.
+    if (N1.getValueType() == MVT::Vector) {
+      assert(isa<ConstantSDNode>(*(N1.Val->op_end()-2)) &&
+             isa<VTSDNode>(*(N1.Val->op_end()-1)) && "Malformed vector input!");
+      if (*(N1.Val->op_end()-2) == N2 && *(N1.Val->op_end()-1) == N3)
+        return N1;
+    }
+    break;
   }
 
   // Memoize node if it doesn't produce a flag.