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

Christudasan Devadasan via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 4 23:16:58 PST 2024


cdevadas wrote:

The isBasicBlockPrologue hook was something introduced by AMDGPU and have been in real use only for our backend. I share the same concerns discussed between Alex and Ruiling.
The flag based (or label based) Prolog partition was discussed by Matt a few times earlier when we tried to improve this hook.  
But he gave up that idea by stating that the demarcation based on a flag would be highly unstable as many codegen passes might spoil it by incorrect insertion or incorrect scheduling so that we loose this flag or its purpose.
I agree that we should rename this hook to `skipBlockPrologue` and use this to skip past the prolog instructions in a single go.

I also think we should consolidate `SkipPHIsAndLabels` & `SkipPHIsLabelsAndDebug` into the new hook `skipBlockPrologue` (use an additional argument to include DebugInstr or not). 
Because the former two functions, IIUC, are trying to skip past the generic prolog instructions which are PHIs, Labels, some pseudos, debugInstr, etc. There must be a default implementation of `skipBlockPrologue` that skips the generic instructions and then allow targets to define their own prolog instructions (something that we're trying to fix now).

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


More information about the llvm-commits mailing list