This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Annotate functions that have stack objects
ClosedPublic

Authored by arsenm on May 19 2020, 1:21 PM.

Details

Summary

Relying on any MachineFunction state in the MachineFunctionInfo
constructor is hazardous, because the construction time is unclear and
determined by the first use. The function may be only partially
constructed, which is part of why we have many of these hacky string
attributes to track what we need for ABI lowering.

For SelectionDAG, all stack objects are created up-front before
calling convention lowering so stack objects are visible at
construction time. For GlobalISel, none of the IR function has been
visited yet and the allocas haven't been added to the MachineFrameInfo
yet. This should fix failing to set flat_scratch_init in GlobalISel
when needed.

This pass really needs to be turned into some kind of analysis, but I
haven't found a nice way use one here.

Diff Detail

Event Timeline

arsenm created this revision.May 19 2020, 1:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2020, 1:21 PM
This revision is now accepted and ready to land.May 19 2020, 1:47 PM
foad added inline comments.Nov 13 2023, 3:38 AM
llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch-init.ll
1

Was this supposed to have -global-isel?

Herald added a project: Restricted Project. · View Herald TranscriptNov 13 2023, 3:38 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
arsenm added inline comments.Nov 13 2023, 3:50 AM
llvm/test/CodeGen/AMDGPU/GlobalISel/flat-scratch-init.ll
1

Yes