[llvm-branch-commits] [llvm] [2/2][AMDGPU] Insert IMPLICIT_DEF to provide a reaching def for unspilled reloads (PR #200126)

Dhruva Chakrabarti via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 9 19:06:56 PDT 2026


dhruvachak wrote:

>From https://github.com/llvm/llvm-project/pull/198472#discussion_r3357514733


> > But what's the point of that IMPLICIT_DEF?
> 
> The discussion was about the correctness of that extra implicit_def. I don't know what you are asking for. It is just a left-over of a very simple implementation. It allows you to fix the issue with just very few lines and don't need the traversal along the CFG.

If you are saying that a correct placement of IMPLICIT_DEF can be computed based solely on LiveStacks, then I am missing something. So, my ask is: please sketch an implementation based on LiveStacks that works for all cases. 

My primary concern is about the segments which do not have any spill store. For my example CFG, the path from H -> N is one such segment. Clearly, any IMPLICIT_DEF in that path H -> N would clobber live value through the back-edge. If we try to move up the chain of dominator nodes to find a placement for IMPLICIT_DEF, that's not enough either. We have to find a block such that no live value from a spill store reaches that block. By the time this is implemented, you already have CFG-based dataflow. And that's exactly what my 2nd PR https://github.com/llvm/llvm-project/pull/200126 does. And then you don't need the LiveStacks-based implementation anymore.



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


More information about the llvm-branch-commits mailing list