From 5624de7d8d45ff640274f5cf1201acafcc444fba Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Tue, 20 Dec 2016 17:09:52 +0000 Subject: [PATCH] [X86][SSE] Ensure we're only combining shuffles with legal mask types. I haven't managed to get this to fail yet but its technically possible for the AND -> shuffle decomposition to result in illegal types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290183 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelLowering.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 1470952f176..a2eb654bcd2 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -26460,6 +26460,10 @@ static bool combineX86ShuffleChain(ArrayRef 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;