[PATCH] D123932: MachineModuleInfo: Move HasSplitStack handling to AsmPrinter

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 14:30:54 PDT 2022


arsenm added a comment.

In D123932#3457400 <https://reviews.llvm.org/D123932#3457400>, @rnk wrote:

> I read through the situation described in PR37807 <https://github.com/llvm/llvm-project/issues/37155> the two relevant commits (rG9cc1ffadc5ad06ab846a7da95a1afb874b9f3d98 <https://reviews.llvm.org/rG9cc1ffadc5ad06ab846a7da95a1afb874b9f3d98> and D48444 <https://reviews.llvm.org/D48444>), and I think I understand the two issues.
>
> I think it would be simpler if we tracked a boolean (`HasSplitStackPrologue`) on each MachineFrameInfo object indicating whether a split stack prologue was emitted or not for some particular function. This avoids the need to duplicate this stack size and tail call checking logic in the AsmPrinter.
>
> The root of the issue here is that we are checking IR attributes in `MF.shouldSplitStack()`, but we allow ourselves to revise that decision during prologue emission if we have a leaf function that doesn't use any stack. The AsmPrinter should look at the MIR, not the IR, and that will simplify things.

I tried this and it doesn't quite work. Maintaining the current behavior requires 2 fields; that split-stacks requested and whether or not it was actually emitted. Do you think it would be better to just move the StackSize == 0 && !MFI.hasTailCall() check into a helper in MFI, track a second field in MFI, or just keep having the AsmPrinter look at the attribute?


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

https://reviews.llvm.org/D123932



More information about the llvm-commits mailing list