From: Simon Pilgrim Date: Tue, 15 Oct 2019 17:59:13 +0000 (+0000) Subject: [X86] combineX86ShufflesRecursively - split the getTargetShuffleInputs call from... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=359ee0e0705559430429ab3d3e392a7c332a920d;p=llvm [X86] combineX86ShufflesRecursively - split the getTargetShuffleInputs call from the resolveTargetShuffleAndZeroables call. Exposes an issue in getFauxShuffleMask where the OR(SHUFFLE,SHUFFLE) decode should always resolve zero/undef elements. Part of the fix for PR43024 where ideally we shouldn't call resolveTargetShuffleAndZeroables for Depth == 0 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374928 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index df08ebfe076..bdc05ad65f0 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -6932,9 +6932,9 @@ static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts, SmallVector SrcMask0, SrcMask1; SmallVector SrcInputs0, SrcInputs1; if (!getTargetShuffleInputs(N0, SrcInputs0, SrcMask0, DAG, Depth + 1, - ResolveKnownElts) || + true) || !getTargetShuffleInputs(N1, SrcInputs1, SrcMask1, DAG, Depth + 1, - ResolveKnownElts)) + true)) return false; size_t MaskSize = std::max(SrcMask0.size(), SrcMask1.size()); SmallVector Mask0, Mask1; @@ -33012,11 +33012,17 @@ static SDValue combineX86ShufflesRecursively( "Can only combine shuffles of the same vector register size."); // Extract target shuffle mask and resolve sentinels and inputs. + // TODO - determine Op's demanded elts from RootMask. SmallVector OpMask; SmallVector OpInputs; - if (!getTargetShuffleInputs(Op, OpInputs, OpMask, DAG, Depth)) + APInt OpUndef, OpZero; + APInt OpDemandedElts = APInt::getAllOnesValue(VT.getVectorNumElements()); + if (!getTargetShuffleInputs(Op, OpDemandedElts, OpInputs, OpMask, OpUndef, + OpZero, DAG, Depth, false)) return SDValue(); + resolveTargetShuffleAndZeroables(OpMask, OpUndef, OpZero); + // Add the inputs to the Ops list, avoiding duplicates. SmallVector Ops(SrcOps.begin(), SrcOps.end());