Skip to content

Conversation

@RKSimon
Copy link
Collaborator

@RKSimon RKSimon commented Dec 5, 2025

Noticed while investigating a regression reported after #168706 - don't attempt this if any elements are zero/undef - there is a potential issue with reverse(insert_subvector(undef,load(),0)) patterns - but I haven't managed to create a fail case.

…tterns from all load element patterns

Noticed while investigating a regression reported after llvm#168706 - don't attempt this if any elements are zero/undef - there is a potential issue with reverse(insert_subvector(undef,load(),0)) patterns - but I haven't managed to create a fail case
@llvmbot
Copy link
Member

llvmbot commented Dec 5, 2025

@llvm/pr-subscribers-backend-x86

Author: Simon Pilgrim (RKSimon)

Changes

Noticed while investigating a regression reported after #168706 - don't attempt this if any elements are zero/undef - there is a potential issue with reverse(insert_subvector(undef,load(),0)) patterns - but I haven't managed to create a fail case.


Full diff: https://github.com/llvm/llvm-project/pull/170852.diff

1 Files Affected:

  • (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (+2-1)
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 2722321a03e2e..d0ae75b2e6785 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -7571,7 +7571,8 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef<SDValue> Elts,
 
   // REVERSE - attempt to match the loads in reverse and then shuffle back.
   // TODO: Do this for any permute or mismatching element counts.
-  if (Depth == 0 && !ZeroMask && TLI.isTypeLegal(VT) && VT.isVector() &&
+  if (Depth == 0 && ZeroMask.isZero() && UndefMask.isZero() &&
+      TLI.isTypeLegal(VT) && VT.isVector() &&
       NumElems == VT.getVectorNumElements()) {
     SmallVector<SDValue, 16> ReverseElts(Elts.rbegin(), Elts.rend());
     if (SDValue RevLd = EltsFromConsecutiveLoads(

@RKSimon RKSimon enabled auto-merge (squash) December 5, 2025 13:43
@RKSimon RKSimon merged commit 0a65849 into llvm:main Dec 5, 2025
11 of 12 checks passed
@RKSimon RKSimon deleted the x86-reverse-consecutive branch December 5, 2025 14:59
@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 5, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-mlir-rhel-clang running on ppc64le-mlir-rhel-test while building llvm at step 6 "test-build-check-mlir-build-only-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/129/builds/34451

Here is the relevant piece of the build log for the reference
Step 6 (test-build-check-mlir-build-only-check-mlir) failure: 1200 seconds without output running [b'ninja', b'check-mlir'], attempting to kill
...
PASS: MLIR-Unit :: IR/./MLIRIRTests/101/130 (3713 of 3724)
PASS: MLIR :: mlir-tblgen/llvm-intrinsics.td (3714 of 3724)
PASS: MLIR-Unit :: IR/./MLIRIRTests/0/130 (3715 of 3724)
PASS: MLIR-Unit :: IR/./MLIRIRTests/39/130 (3716 of 3724)
PASS: MLIR-Unit :: IR/./MLIRIRTests/38/130 (3717 of 3724)
PASS: MLIR-Unit :: Interfaces/./MLIRInterfacesTests/11/22 (3718 of 3724)
PASS: MLIR-Unit :: Interfaces/./MLIRInterfacesTests/13/22 (3719 of 3724)
PASS: MLIR-Unit :: Pass/./MLIRPassTests/10/13 (3720 of 3724)
PASS: MLIR-Unit :: Interfaces/./MLIRInterfacesTests/12/22 (3721 of 3724)
PASS: MLIR :: mlir-reduce/dce-test.mlir (3722 of 3724)
command timed out: 1200 seconds without output running [b'ninja', b'check-mlir'], attempting to kill
process killed by signal 9
program finished with exit code -1
elapsedTime=3026.984528

RKSimon added a commit to RKSimon/llvm-project that referenced this pull request Dec 5, 2025
… reverse(vzload(ptr)) patterns

This was fixed by llvm#170852 - previously we're get stuck in a loop: shuffle(movq(p),undef,1,0) -> bulid_vector(0, p[0]) -> shuffle(movq(p),1,0) .....
RKSimon added a commit that referenced this pull request Dec 5, 2025
… reverse(vzload(ptr)) patterns (#170889)

This was fixed by #170852 - previously we're get stuck in a loop:
shuffle(movq(p),undef,1,0) -> bulid_vector(0, p[0]) -> shuffle(movq(p),1,0) .....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants