[llvm] 465c904 - [X86] combineX86ShufflesRecursively - delay widening shuffle inputs. NFC. (#204931)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 20 08:01:35 PDT 2026
Author: Simon Pilgrim
Date: 2026-06-20T15:01:30Z
New Revision: 465c904272709002665bd86765d8f11dc9390a98
URL: https://github.com/llvm/llvm-project/commit/465c904272709002665bd86765d8f11dc9390a98
DIFF: https://github.com/llvm/llvm-project/commit/465c904272709002665bd86765d8f11dc9390a98.diff
LOG: [X86] combineX86ShufflesRecursively - delay widening shuffle inputs. NFC. (#204931)
Perform resolveTargetShuffleInputsAndMask earlier as widening shouldn't
merge any inputs (we canonicalize small shuffle inputs earlier).
We should be able to move the widenSubVector calls inside
combineX86ShuffleChain in a future commit, but this patch should be NFC.
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 e9ba1c05df361..7e9e82ae49f9e 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -42467,21 +42467,9 @@ static SDValue combineX86ShufflesRecursively(
Op, OpScaledDemandedElts, DAG))
Op = NewOp;
}
- // FIXME: should we rerun resolveTargetShuffleInputsAndMask() now?
- // Widen any subvector shuffle inputs we've collected.
- // TODO: Remove this to avoid generating temporary nodes, we should only
- // widen once combineX86ShuffleChain has found a match.
- if (any_of(Ops, [RootSizeInBits](SDValue Op) {
- return Op.getValueSizeInBits() < RootSizeInBits;
- })) {
- for (SDValue &Op : Ops)
- if (Op.getValueSizeInBits() < RootSizeInBits)
- Op = widenSubVector(Op, false, Subtarget, DAG, SDLoc(Op),
- RootSizeInBits);
- // Reresolve - we might have repeated subvector sources.
- resolveTargetShuffleInputsAndMask(Ops, Mask);
- }
+ // Reresolve - we might have repeated subvector sources.
+ resolveTargetShuffleInputsAndMask(Ops, Mask);
// Handle the all undef/zero/ones cases.
if (all_of(Mask, [](int Idx) { return Idx == SM_SentinelUndef; }))
@@ -42494,6 +42482,18 @@ static SDValue combineX86ShufflesRecursively(
assert(!Ops.empty() && "Shuffle with no inputs detected");
+ // Widen any subvector shuffle inputs we've collected.
+ // TODO: Remove this to avoid generating temporary nodes, we should only
+ // widen once combineX86ShuffleChain has found a match.
+ if (any_of(Ops, [RootSizeInBits](SDValue Op) {
+ return Op.getValueSizeInBits() < RootSizeInBits;
+ })) {
+ for (SDValue &Op : Ops)
+ if (Op.getValueSizeInBits() < RootSizeInBits)
+ Op = widenSubVector(Op, false, Subtarget, DAG, SDLoc(Op),
+ RootSizeInBits);
+ }
+
// We can only combine unary and binary shuffle mask cases.
if (Ops.size() <= 2) {
// Minor canonicalization of the accumulated shuffle mask to make it easier
More information about the llvm-commits
mailing list