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

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 19:10:33 PDT 2024


ruiling wrote:

> Such a change would affect all targets but we could create a hook that does the same walk by default calling isBasicBlockPrologue but does something smart for AMDGPU. The problem is that the TargetInstrInfo is a stateless class so we cannot store information in it.

I think targetInstrInfo is not kind of stable ABI that needs high bar to change, right? We are the only target that implement the isBasicBlockPrologue() in tree. For out-of-tree target, it is fairly easy to switch to the new hook.

>The best approach would be to lazily compute a kind of a MachineInstr property (a flag?) and cache it. If we could, the query for the "prologue" property is immediate. I was thinking of adding a bit in tsFlags as I know there exist few free positions.

I would say the "prologue" is not a static property for certain types of instructions. An instruction is part of prologue because it appears before the exec modification instruction.



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


More information about the llvm-commits mailing list