@@ -39554,13 +39554,11 @@ static SDValue canonicalizeShuffleMaskWithHorizOp(
39554
39554
// Attempt to constant fold all of the constant source ops.
39555
39555
// Returns true if the entire shuffle is folded to a constant.
39556
39556
// TODO: Extend this to merge multiple constant Ops and update the mask.
39557
- static SDValue combineX86ShufflesConstants(ArrayRef<SDValue> Ops,
39558
- ArrayRef<int> Mask, SDValue Root,
39557
+ static SDValue combineX86ShufflesConstants(MVT VT, ArrayRef<SDValue> Ops,
39558
+ ArrayRef<int> Mask,
39559
39559
bool HasVariableMask,
39560
- SelectionDAG &DAG,
39560
+ SelectionDAG &DAG, const SDLoc &DL,
39561
39561
const X86Subtarget &Subtarget) {
39562
- MVT VT = Root.getSimpleValueType();
39563
-
39564
39562
unsigned SizeInBits = VT.getSizeInBits();
39565
39563
unsigned NumMaskElts = Mask.size();
39566
39564
unsigned MaskSizeInBits = SizeInBits / NumMaskElts;
@@ -39585,7 +39583,6 @@ static SDValue combineX86ShufflesConstants(ArrayRef<SDValue> Ops,
39585
39583
return SDValue();
39586
39584
39587
39585
// Shuffle the constant bits according to the mask.
39588
- SDLoc DL(Root);
39589
39586
APInt UndefElts(NumMaskElts, 0);
39590
39587
APInt ZeroElts(NumMaskElts, 0);
39591
39588
APInt ConstantElts(NumMaskElts, 0);
@@ -39625,7 +39622,7 @@ static SDValue combineX86ShufflesConstants(ArrayRef<SDValue> Ops,
39625
39622
39626
39623
// Attempt to create a zero vector.
39627
39624
if ((UndefElts | ZeroElts).isAllOnes())
39628
- return getZeroVector(Root.getSimpleValueType() , Subtarget, DAG, DL);
39625
+ return getZeroVector(VT , Subtarget, DAG, DL);
39629
39626
39630
39627
// Create the constant data.
39631
39628
MVT MaskSVT;
@@ -39691,6 +39688,7 @@ static SDValue combineX86ShufflesRecursively(
39691
39688
MVT RootVT = Root.getSimpleValueType();
39692
39689
assert(RootVT.isVector() && "Shuffles operate on vector types!");
39693
39690
unsigned RootSizeInBits = RootVT.getSizeInBits();
39691
+ SDLoc DL(Root);
39694
39692
39695
39693
// Bound the depth of our recursive combine because this is ultimately
39696
39694
// quadratic in nature.
@@ -39946,10 +39944,10 @@ static SDValue combineX86ShufflesRecursively(
39946
39944
if (all_of(Mask, [](int Idx) { return Idx == SM_SentinelUndef; }))
39947
39945
return DAG.getUNDEF(RootVT);
39948
39946
if (all_of(Mask, [](int Idx) { return Idx < 0; }))
39949
- return getZeroVector(RootVT, Subtarget, DAG, SDLoc(Root) );
39947
+ return getZeroVector(RootVT, Subtarget, DAG, DL );
39950
39948
if (Ops.size() == 1 && ISD::isBuildVectorAllOnes(Ops[0].getNode()) &&
39951
39949
!llvm::is_contained(Mask, SM_SentinelZero))
39952
- return getOnesVector(RootVT, DAG, SDLoc(Root) );
39950
+ return getOnesVector(RootVT, DAG, DL );
39953
39951
39954
39952
assert(!Ops.empty() && "Shuffle with no inputs detected");
39955
39953
HasVariableMask |= IsOpVariableMask;
@@ -39990,7 +39988,7 @@ static SDValue combineX86ShufflesRecursively(
39990
39988
39991
39989
// Attempt to constant fold all of the constant source ops.
39992
39990
if (SDValue Cst = combineX86ShufflesConstants(
39993
- Ops, Mask, Root, HasVariableMask, DAG, Subtarget))
39991
+ RootVT, Ops, Mask, HasVariableMask, DAG, DL , Subtarget))
39994
39992
return Cst;
39995
39993
39996
39994
// If constant fold failed and we only have constants - then we have
@@ -40010,7 +40008,7 @@ static SDValue combineX86ShufflesRecursively(
40010
40008
// Canonicalize the combined shuffle mask chain with horizontal ops.
40011
40009
// NOTE: This will update the Ops and Mask.
40012
40010
if (SDValue HOp = canonicalizeShuffleMaskWithHorizOp(
40013
- Ops, Mask, RootSizeInBits, SDLoc(Root) , DAG, Subtarget))
40011
+ Ops, Mask, RootSizeInBits, DL , DAG, Subtarget))
40014
40012
return DAG.getBitcast(RootVT, HOp);
40015
40013
40016
40014
// Try to refine our inputs given our knowledge of target shuffle mask.
0 commit comments