[all-commits] [llvm/llvm-project] bf420f: [AArch64] Fix hasNearbyPairedStore to handle non-i...
Kunal Pathak via All-commits
all-commits at lists.llvm.org
Tue May 26 15:33:40 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bf420f0d18562cd4a3ec7ae65354c62970adb262
https://github.com/llvm/llvm-project/commit/bf420f0d18562cd4a3ec7ae65354c62970adb262
Author: Kunal Pathak <kunalspathak.github at gmail.com>
Date: 2026-05-26 (Tue, 26 May 2026)
Changed paths:
M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
A llvm/test/CodeGen/AArch64/interleaved-store-noninbounds-gep.ll
Log Message:
-----------
[AArch64] Fix hasNearbyPairedStore to handle non-inbounds GEPs (#199137)
Problem: `hasNearbyPairedStore` uses
`stripAndAccumulateInBoundsConstantOffsets` to decompose store pointers
into (base, offset) pairs and check whether two stores are 16 bytes
apart. This fails when LSR has rewritten pointer arithmetic into
non-inbounds GEPs because the function refuses to look through them. The
two stores then appear to have different base pointers and the check
returns false. When this happens, `lowerInterleavedStore` proceeds to
emit `ST2` for a pattern that would be more profitable as `zip+stp`,
since the load-store optimizer can pair adjacent stores into `STP` but
cannot merge `ST2` with anything. On a bf16-to-fp32 NEON conversion loop
this causes a regression from 11 to 17 instructions per iteration.
Note: Interleaved stores support was added for RISCV in
https://github.com/llvm/llvm-project/pull/115354. Turning this off
produces the desired STP instructions.
https://godbolt.org/z/1afsjPd3e
Fix: Switch to `stripAndAccumulateConstantOffsets` with
`AllowNonInbounds=true`. The function is a bail-out heuristic doing pure
address arithmetic, so the inbounds semantic guarantee is not needed for
correctness.
---------
Co-authored-by: Kunal Pathak <kupathak at fb.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list