[llvm] [AMDGPU] Delete dead meta instructions (PR #193030)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 22 13:57:11 PDT 2026
LU-JOHN wrote:
> I feel like I'm missing the big picture here. Do other targets suffer from this problem? Is `optimizeVccBranch` the _only_ cause of these mostly-empty blocks? Why is `dead-mi-elimination` "too aggressive"?
The cause of mostly-empty blocks is not _only_ `optimizeVccBranch`. With our lit tests there are ~1240 blocks ending in S_BRANCH that contain only IMPLICIT_DEF insns. 14 of them are not created by `optimizeVccBranch`.
`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.
https://github.com/llvm/llvm-project/pull/193030
More information about the llvm-commits
mailing list