[llvm-commits] [llvm] r57965 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Duncan Sands baldrick at free.fr
Wed Oct 22 02:00:33 PDT 2008


Author: baldrick
Date: Wed Oct 22 04:00:33 2008
New Revision: 57965

URL: http://llvm.org/viewvc/llvm-project?rev=57965&view=rev
Log:
Temporarily allow the operands of a BUILD_VECTOR
to have a different type to the vector element
type.  This should be fairly harmless because in
the past guys like this were being built all over
the place (and were cleaned up when I added this
check).  The reason for relaxing this check is
that it helps LegalizeTypes legalize vector
shuffles: the mask is a BUILD_VECTOR that it is
*not always possible* to legalize while keeping it
a BUILD_VECTOR (vector_shuffle requires the mask
to be a BUILD_VECTOR, as opposed to a vector with
the right vector type).  With this check it is even
harder to legalize the mask - turning the check off
means that LegalizeTypes manages to legalize almost
all vector shuffles encountered in practice.  The
correct solution is to change vector_shuffle to be a
variadic node with the mask built into it as operands.
While waiting for that change, this hack stops the
problem with vector_shuffle from blocking the turning
on of LegalizeTypes.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=57965&r1=57964&r2=57965&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Oct 22 04:00:33 2008
@@ -797,10 +797,14 @@
     assert(N->getValueType(0).isVector() && "Wrong BUILD_VECTOR return type!");
     assert(N->getNumOperands() == N->getValueType(0).getVectorNumElements() &&
            "Wrong number of BUILD_VECTOR operands!");
-    MVT EltVT = N->getValueType(0).getVectorElementType();
-    for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I)
-      assert(I->getSDValue().getValueType() == EltVT &&
-             "Wrong BUILD_VECTOR operand type!");
+    // FIXME: Change vector_shuffle to a variadic node with mask elements being
+    // operands of the node.  Currently the mask is a BUILD_VECTOR passed as an
+    // operand, and it is not always possible to legalize it.  Turning off the
+    // following checks at least makes it possible to legalize most of the time.
+//    MVT EltVT = N->getValueType(0).getVectorElementType();
+//    for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I)
+//      assert(I->getSDValue().getValueType() == EltVT &&
+//             "Wrong BUILD_VECTOR operand type!");
     break;
   }
   }





More information about the llvm-commits mailing list