[PATCH] D90036: [AMDGPU] Emit stack frame size in metadata

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 08:42:11 PST 2020


nhaehnle added inline comments.


================
Comment at: llvm/test/CodeGen/AMDGPU/amdpal-callable.ll:104
+; GCN-NEXT:      dynamic_stack:
+; GCN-NEXT:        .stack_frame_size_in_bytes: 0x10
+; GCN-NEXT:      no_stack:
----------------
Flakebi wrote:
> foad wrote:
> > Flakebi wrote:
> > > foad wrote:
> > > > Flakebi wrote:
> > > > > arsenm wrote:
> > > > > > This doesn't really represent the unknown nature of the stack size, but I guess there isn't a key for this yet?
> > > > > I guess it should be the maximum that the function needs at any point, so 0x10 sounds right?
> > > > Then what would it report if there was an alloca in a loop?
> > > The same as with an if, I think allocas in a loop don’t stack, so there should be a maximum stack usage that can be statically computed.
> > Yes they do stack. It's used for implementing standard(ish) C alloca().
> Hm ok, I guess we’re doomed then.
For the use cases we care about in graphics, we should never have `alloca` outside of the function entry point, and therefore the stack frame size is always a constant.

We could interpret "stack_frame_size_in_bytes" as the minimum stack frame size and add a boolean field "stack_frame_size_dynamic". We're not going to need it for a long time though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90036/new/

https://reviews.llvm.org/D90036



More information about the llvm-commits mailing list