[llvm] r230176 - [DAGCombine] Don't assume integer-type legailty in reduceBuildVecConvertToConvertBuildVec

Hal Finkel hfinkel at anl.gov
Sun Feb 22 08:10:22 PST 2015


Author: hfinkel
Date: Sun Feb 22 10:10:22 2015
New Revision: 230176

URL: http://llvm.org/viewvc/llvm-project?rev=230176&view=rev
Log:
[DAGCombine] Don't assume integer-type legailty in reduceBuildVecConvertToConvertBuildVec

DAGCombine will rewrite an BUILD_VECTOR where all non-undef inputs some from
[US]INT_TO_FP, as a BUILD_VECTOR of integers with the conversion applied as a
vector operation. We check operation legality of the conversion, but fail to
check legality of the integer vector type itself. Because targets don't
normally override operation legality defaults for illegal types, we need to
check this also.

This came up in the context of the QPX vector entensions for PowerPC (which can
have legal floating-point vector types without corresponding legal integer
vector types). No in-tree test case for this yes, but one can be added once
the QPX support has been committed.

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=230176&r1=230175&r2=230176&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sun Feb 22 10:10:22 2015
@@ -11194,6 +11194,11 @@ SDValue DAGCombiner::reduceBuildVecConve
   if (!TLI.isOperationLegalOrCustom(Opcode, NVT))
     return SDValue();
 
+  // Just because the floating-point vector type is legal does not necessarily
+  // mean that the corresponding integer vector type is.
+  if (!isTypeLegal(NVT))
+    return SDValue();     
+
   SmallVector<SDValue, 8> Opnds;
   for (unsigned i = 0; i != NumInScalars; ++i) {
     SDValue In = N->getOperand(i);





More information about the llvm-commits mailing list