[llvm] [AMDGPU] Skip spill slot elimination when reload isn't dominated by stores (PR #215953)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 18 02:12:40 PDT 2026
================
@@ -0,0 +1,168 @@
+; REQUIRES: asserts
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx950 -O3 -verify-machineinstrs \
+; RUN: -stop-after=amdgpu-rewrite-agpr-copy-mfma \
+; RUN: -debug-only=amdgpu-rewrite-agpr-copy-mfma -filetype=null %s 2>&1 \
+; RUN: | FileCheck %s
+
+; Reduced from a bf16 multi-head-attention kernel (issue #196671). Register
+; allocation spills some of the <16 x float> MFMA accumulators around the
+; if/else diamond in the loop: the spill stores end up in the two conditional
+; arms, while the reload
+; sits in the join block, which is also reachable through a path that bypasses
+; both arms. When the rewrite pass frees registers by switching MFMAs to their
+; AGPR form and then tries to replace such a spill slot with a register, the
+; replacement register's reload is not dominated by its defs and computing its
+; live interval fails a machine verifier check ("Virtual register defs don't
+; dominate all uses"). Check that the slot is skipped instead.
+
+; CHECK: Skipping SS#{{[0-9]+}}: reload not jointly dominated by stores
+
+target triple = "amdgcn-amd-amdhsa"
+
+define amdgpu_kernel void @reload_not_jointly_dominated_by_stores(i1 %arg, <16 x float> %.sroa.366.2) #0 {
----------------
arsenm wrote:
Maybe can add merge this test to the other patch's
https://github.com/llvm/llvm-project/pull/215953
More information about the llvm-commits
mailing list