[llvm] [AMDGPU] Improve isBasicBlockPrologue to only add necessary instructions (PR #113303)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 10:38:56 PST 2024


alex-t wrote:


> I don't think the def-use relationship is important when checking whether an instruction belong to the prologue. The prologue concept is mainly used to find right insertion point for vector instructions (anything else?). For scalar instructions that produce the input to the exec mask setup, yes, we have to put them inside the prologue for correctness. For other scalar instructions, we can either put them in the prologue or after. Right?
>
Adding odd instructions in the prologue is undesirable because any instruction defining a register starts the segment in a live range.
While LI splitting we insert the copies right after the prologue. I want to minimize the number of instructions creating new segments in the prologue to avoid possible interference.
As for the def-use information, I kept in mind the scenario where the SGPR reload loads an operand for WWM buffer load (offset operand?) and that WWM buffer load, in its order, loads the VGPR from which we further reload SGPR that is an operand for the EXEC mask update.
I don't know if the scenario above ever exists, but I wanted the algorithm to be as general as possible.

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


More information about the llvm-commits mailing list