Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9790,6 +9790,10 @@ static bool IsElementEquivalent(int MaskSize, SDValue Op, SDValue ExpectedOp,
(int)ExpectedVT.getVectorNumElements() != MaskSize)
return false;

// Exact match.
if (Idx == ExpectedIdx && Op == ExpectedOp)
return true;

switch (Op.getOpcode()) {
case ISD::BUILD_VECTOR:
// If the values are build vectors, we can look through them to find
Expand Down Expand Up @@ -9837,8 +9841,7 @@ static bool IsElementEquivalent(int MaskSize, SDValue Op, SDValue ExpectedOp,
SmallVector<int, 8> Mask;
DecodeVPERMMask(MaskSize, Op.getConstantOperandVal(1), Mask);
SDValue Src = Op.getOperand(0);
return (Mask[Idx] == Mask[ExpectedIdx]) ||
IsElementEquivalent(MaskSize, Src, Src, Mask[Idx],
return IsElementEquivalent(MaskSize, Src, Src, Mask[Idx],
Mask[ExpectedIdx]);
}
break;
Expand Down