From 01500276c25529d83cd18b1443efa4a552f2215e Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 7 Oct 2019 16:15:20 +0000 Subject: [PATCH] [X86][SSE] getTargetShuffleInputs - move VT.isSimple/isVector checks inside. NFCI. Stop all the callers from having to check the value type before calling getTargetShuffleInputs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373915 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelLowering.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 915046048ff..3806b0e2330 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -7259,6 +7259,10 @@ static bool getTargetShuffleInputs(SDValue Op, const APInt &DemandedElts, SmallVectorImpl &Mask, SelectionDAG &DAG, unsigned Depth, bool ResolveZero) { + EVT VT = Op.getValueType(); + if (!VT.isSimple() || !VT.isVector()) + return false; + APInt KnownUndef, KnownZero; if (getTargetShuffleAndZeroables(Op, Mask, Inputs, KnownUndef, KnownZero)) { for (int i = 0, e = Mask.size(); i != e; ++i) { @@ -7280,6 +7284,10 @@ static bool getTargetShuffleInputs(SDValue Op, SmallVectorImpl &Inputs, SmallVectorImpl &Mask, SelectionDAG &DAG, unsigned Depth = 0, bool ResolveZero = true) { + EVT VT = Op.getValueType(); + if (!VT.isSimple() || !VT.isVector()) + return false; + unsigned NumElts = Op.getValueType().getVectorNumElements(); APInt DemandedElts = APInt::getAllOnesValue(NumElts); return getTargetShuffleInputs(Op, DemandedElts, Inputs, Mask, DAG, Depth, @@ -34574,8 +34582,8 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode( // Get target/faux shuffle mask. SmallVector OpMask; SmallVector OpInputs; - if (!VT.isSimple() || !getTargetShuffleInputs(Op, DemandedElts, OpInputs, - OpMask, TLO.DAG, Depth, false)) + if (!getTargetShuffleInputs(Op, DemandedElts, OpInputs, OpMask, TLO.DAG, + Depth, false)) return false; // Shuffle inputs must be the same size as the result. @@ -34954,8 +34962,7 @@ SDValue X86TargetLowering::SimplifyMultipleUseDemandedBitsForTargetNode( SmallVector ShuffleMask; SmallVector ShuffleOps; - if (VT.isSimple() && VT.isVector() && - getTargetShuffleInputs(Op, ShuffleOps, ShuffleMask, DAG, Depth)) { + if (getTargetShuffleInputs(Op, ShuffleOps, ShuffleMask, DAG, Depth)) { // If all the demanded elts are from one operand and are inline, // then we can use the operand directly. int NumOps = ShuffleOps.size(); -- 2.40.0