[X86][SSE] Ensure we're only combining shuffles with legal mask types.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 20 Dec 2016 17:09:52 +0000 (17:09 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 20 Dec 2016 17:09:52 +0000 (17:09 +0000)
I haven't managed to get this to fail yet but its technically possible for the AND -> shuffle decomposition to result in illegal types.

llvm-svn: 290183

llvm/lib/Target/X86/X86ISelLowering.cpp

index 1470952..a2eb654 100644 (file)
@@ -26460,6 +26460,10 @@ static bool combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
                            : MVT::getIntegerVT(MaskEltSizeInBits);
   MaskVT = MVT::getVectorVT(MaskVT, NumMaskElts);
 
+  // Only allow legal mask types.
+  if (!DAG.getTargetLoweringInfo().isTypeLegal(MaskVT))
+    return false;
+
   // Attempt to match the mask against known shuffle patterns.
   MVT ShuffleSrcVT, ShuffleVT;
   unsigned Shuffle, PermuteImm;