[llvm] [AMDGPU] Avoid put implicit_def into bundle that break reg's liveness (PR #142563)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 01:28:32 PDT 2025


Shoreshen wrote:

Hi @arsenm , by "cannot include implicit_def in the BUNDLE" is based on if we do not change the logic of machineinst verifer.

However, personally I think its little bit complicated because it not only create use undefined reg error for instructions inside the bundle, but also for BUNDLE inst itself since it add reg def & use to the BUNDLE inst. 

In order to solve error for BUNDLE inst itself, we can do:
1. Exclude the def & use inside the BUNDLE from the BUNDLE inst's def & use. or
2. Change the logic of verifier that do not check the reg liveness for BUNDLE inst (if use undefined reg occurs for BUNDLE itself, we need to further check inside instructions that it is not implicit defined, which act like normal reg liveness check)

Since the def & use of BUNDLE inst is hand written in different backends, it requires us to change all backend's BUNDLE creation logic if we want to use method 1.

If we use method 2, we give up opportunity to early reject bad code for BUNDLE.

So my preference is to adjust AMDGPU backend only for safety and its easier to modify. However if other method is the proper way of fixing or there maybe other methods can do better, I'm willing to implement it. Thanks


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


More information about the llvm-commits mailing list