[llvm] [AMDGCN][SIWholeQuadMode] Handle case when SI_KILL_I1_TERMINATOR -1,0 is not the only terminator (PR #122922)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 08:18:24 PST 2025


jmmartinez wrote:

> Let me try again. Before your patch si-wqm generates:
> 
> ```
> 256B	bb.2.endif1:
> 	; predecessors: %bb.0, %bb.1
> 	  successors: %bb.4(0x80000000); %bb.4(100.00%)
> 
> 272B	  $exec = S_OR_B64 $exec, %0:sreg_64, implicit-def $scc
> 288B	  S_BRANCH %bb.3
> 292B	  S_BRANCH %bb.4
> ```
> 
> Your patch removes the _first_ of these branches. How can that be correct? The _second_ branch is dead code, so removing that would make a lot more sense.

I see what you meant. You're right, there is still a problem with this pass.

The terminator (`S_BRANCH %bb.3`) returned by `lowerKillI1` is used to split the basic-block in 2 . And a new unconditional branch jumping to the new block (`%bb.4`) is inserted in the same block. `lowerKillF32` also does something similar.

I'll rethink this issue.

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


More information about the llvm-commits mailing list