[llvm] r312621 - [DAGCombiner] When combining EXTRACT_SUBVECTOR of a BUILD_VECTOR, make sure we don't create a BUILD_VECTOR with an illegal type after type legalization.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 23:50:03 PDT 2017


Author: ctopper
Date: Tue Sep  5 23:50:03 2017
New Revision: 312621

URL: http://llvm.org/viewvc/llvm-project?rev=312621&view=rev
Log:
[DAGCombiner] When combining EXTRACT_SUBVECTOR of a BUILD_VECTOR, make sure we don't create a BUILD_VECTOR with an illegal type after type legalization.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=312621&r1=312620&r2=312621&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep  5 23:50:03 2017
@@ -15180,8 +15180,9 @@ SDValue DAGCombiner::visitEXTRACT_SUBVEC
         unsigned NumElems = ExtractSize / EltSize;
         EVT ExtractVT = EVT::getVectorVT(*DAG.getContext(),
                                          InVT.getVectorElementType(), NumElems);
-        if (!LegalOperations ||
-            TLI.isOperationLegal(ISD::BUILD_VECTOR, ExtractVT)) {
+        if ((!LegalOperations ||
+             TLI.isOperationLegal(ISD::BUILD_VECTOR, ExtractVT)) &&
+            (!LegalTypes || TLI.isTypeLegal(ExtractVT))) {
           unsigned IdxVal = (Idx->getZExtValue() * NVT.getScalarSizeInBits()) /
                             EltSize;
 




More information about the llvm-commits mailing list