[llvm] AMDGPU: Mark SCC def dead in kill/demote lowering (PR #227024)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 29 02:08:28 PDT 2026


jayfoad wrote:

I'm also seeing this in my EXPENSIVE_CHECKS build:
```
# After SI Whole Quad Mode
********** INTERVALS **********
SGPR0_LO16 [0B,32r:0) 0 at 0B-phi
SGPR1_LO16 [0B,16r:0) 0 at 0B-phi
%2 [32r,48r:0) 0 at 32r  weight:0.000000e+00
%3 [16r,96r:0) 0 at 16r  weight:0.000000e+00
%6 [48r,112r:0) 0 at 48r  weight:0.000000e+00
%9 [100r,104r:0) 0 at 100r  weight:0.000000e+00
%22 [320r,336r:0)[336r,400r:1) 0 at 320r 1 at 336r  L0000000000000030 [336r,400r:0) 0 at 336r  L00000000000000C0 [320r,400r:0) 0 at 320r  weight:0.000000e+00
%23 [384r,400r:0) 0 at 384r  weight:0.000000e+00
%25 [224r,240r:0) 0 at 224r  weight:0.000000e+00
%27 [240r,256r:0) 0 at 240r  weight:0.000000e+00
%34 [480r,496r:0)[496r,560r:1) 0 at 480r 1 at 496r  L0000000000000030 [496r,560r:0) 0 at 496r  L00000000000000C0 [480r,560r:0) 0 at 480r  weight:0.000000e+00
%35 [544r,560r:0) 0 at 544r  weight:0.000000e+00
%38 [104r,192B:0)[192B,224r:2)[416r,464B:1) 0 at 104r 1 at 416r 2 at 192B-phi  weight:0.000000e+00
%39 [8r,120r:1)[120r,120d:0) 0 at 120r 1 at 8r  weight:0.000000e+00
RegMasks:
********** MACHINEINSTRS **********
# Machine code for function scc_use_after_kill_inst: NoPHIs, TracksLiveness, TiedOpsRewritten
Function Live Ins: $sgpr0 in %2, $sgpr1 in %3

0B	bb.0.bb:
	  successors: %bb.1(0x80000000); %bb.1(100.00%)
	  liveins: $sgpr0, $sgpr1
8B	  %39:sreg_64 = COPY $exec
16B	  %3:sgpr_32 = COPY $sgpr1
32B	  %2:sgpr_32 = COPY $sgpr0
48B	  %6:vgpr_32 = nofpexcept V_ADD_F32_e64 0, 1065353216, 0, %2:sgpr_32, 0, 0, implicit $mode, implicit $exec
96B	  S_CMP_LG_U32 %3:sgpr_32, 0, implicit-def $scc
100B	  %9:sreg_64_xexec = nofpexcept V_CMP_LT_F32_e64 0, 0, 0, %6:vgpr_32, 0, implicit $mode, implicit $exec
104B	  %38:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, -1082130432, %9:sreg_64_xexec, implicit $exec
112B	  V_CMP_NLT_F32_e32 0, %6:vgpr_32, implicit-def $vcc, implicit $mode, implicit $exec
120B	  dead %39:sreg_64 = S_ANDN2_B64 %39:sreg_64, $vcc, implicit-def $scc
124B	  SI_EARLY_TERMINATE_SCC0 implicit $exec, implicit $scc
132B	  $exec = S_ANDN2_B64_term $exec, $vcc, implicit-def dead $scc

140B	bb.1.bb:
	; predecessors: %bb.0
	  successors: %bb.3(0x50000000), %bb.2(0x30000000); %bb.3(62.50%), %bb.2(37.50%)
	  liveins: $scc
160B	  S_CBRANCH_SCC1 %bb.3, implicit killed $scc
176B	  S_BRANCH %bb.2

192B	bb.2.phibb:
	; predecessors: %bb.3, %bb.1
	  successors: %bb.4(0x50000000), %bb.5(0x30000000); %bb.4(62.50%), %bb.5(37.50%)

224B	  %25:sreg_64 = nofpexcept V_CMP_EQ_F32_e64 0, 0, 0, %38:vgpr_32, 0, implicit $mode, implicit $exec
240B	  %27:sreg_64 = S_AND_B64 $exec, %25:sreg_64, implicit-def dead $scc
256B	  $vcc = COPY %27:sreg_64
272B	  S_CBRANCH_VCCNZ %bb.4, implicit killed $vcc
288B	  S_BRANCH %bb.5

304B	bb.3.bb8:
	; predecessors: %bb.1
	  successors: %bb.2(0x80000000); %bb.2(100.00%)

320B	  undef %22.sub3:sgpr_128 = S_MOV_B32 61440
336B	  %22.sub2:sgpr_128 = S_MOV_B32 -1
384B	  %23:vgpr_32 = V_MOV_B32_e32 8, implicit $exec
400B	  BUFFER_STORE_DWORD_OFFSET %23:vgpr_32, %22:sgpr_128, 0, 0, 0, 0, implicit $exec :: (volatile store (s32) into `ptr addrspace(1) poison`, addrspace 1)
416B	  %38:vgpr_32 = V_MOV_B32_e32 1082130432, implicit $exec
448B	  S_BRANCH %bb.2

464B	bb.4.bb10:
	; predecessors: %bb.2
	  successors: %bb.5(0x80000000); %bb.5(100.00%)

480B	  undef %34.sub3:sgpr_128 = S_MOV_B32 61440
496B	  %34.sub2:sgpr_128 = S_MOV_B32 -1
544B	  %35:vgpr_32 = V_MOV_B32_e32 9, implicit $exec
560B	  BUFFER_STORE_DWORD_OFFSET %35:vgpr_32, %34:sgpr_128, 0, 0, 0, 0, implicit $exec :: (volatile store (s32) into `ptr addrspace(1) poison`, addrspace 1)

576B	bb.5.end:
	; predecessors: %bb.2, %bb.4

592B	  S_ENDPGM 0

# End machine code for function scc_use_after_kill_inst.

*** Bad machine code: Live in register not found to be live out from predecessor. ***
- function:    scc_use_after_kill_inst
- basic block: %bb.1 bb (0x37bb24f0) [140B;192B)
SCC not found to be live out from %bb.0
LLVM ERROR: Found 1 machine code errors.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
```

https://github.com/llvm/llvm-project/pull/227024


More information about the llvm-commits mailing list