[llvm] ced1f50 - [X86] IsElementEquivalent - pull out exact matching for same index/op. (#143367)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 07:24:16 PDT 2025
Author: Simon Pilgrim
Date: 2025-06-09T15:24:12+01:00
New Revision: ced1f501ce8ec5dce05d577d7d41bc87b7934946
URL: https://github.com/llvm/llvm-project/commit/ced1f501ce8ec5dce05d577d7d41bc87b7934946
DIFF: https://github.com/llvm/llvm-project/commit/ced1f501ce8ec5dce05d577d7d41bc87b7934946.diff
LOG: [X86] IsElementEquivalent - pull out exact matching for same index/op. (#143367)
The types must still be vectors matching MaskSize
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index eafc4acbb1779..244b0f9410b85 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -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
@@ -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;
More information about the llvm-commits
mailing list