[llvm] [AMDGPU] Delete dead meta instructions (PR #193030)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 02:28:56 PDT 2026
jayfoad wrote:
> `dead-mi-elimination` is not safe to use after `si-late-branch-lowering`. In the testcase llvm.amdgcn.ballot.i64.wave32.ll si-late-branch-lowering will convert:
>
> ```
> $sgpr0 = S_MOV_B32 42
> SI_RETURN_TO_EPILOG killed $sgpr0
> ```
>
> to:
>
> ```
> $sgpr0 = S_MOV_B32 42
> ```
>
> If dead-mi-elimination is run afterwards, the S_MOV_B32 will be deleted. There may be other reasons why `dead-mi-elimination` is not safe to invoke, but I didn't investigate further.
This is surely fixable: either don't delete the SI_RETURN_TO_EPILOG instruction (I don't know why does si-late-branch-lowering that), or otherwise mark $sgpr0 as live at function exit.
https://github.com/llvm/llvm-project/pull/193030
More information about the llvm-commits
mailing list