[PATCH] D135488: [codegen][WIP] Display stack layouts in console
Paul Kirth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 7 16:10:33 PDT 2022
paulkirth added a comment.
In D135488#3844117 <https://reviews.llvm.org/D135488#3844117>, @nickdesaulniers wrote:
> Thanks for the patch, here's the output I observe from the LKML thread <https://lore.kernel.org/llvm/20221006222124.aabaemy7ofop7ccz@google.com/>: https://paste.debian.net/1256338/.
>
> I think the stack slot numbers printed at the end aren't correct; the two large allocations should be `table`, `540B` which would be Slot 7 and `stack_fds`, `256B` which would be Slot 8 in the table.
>
> Expected:
>
> Variable: stack_fds (line 634 of fs/select.c) in Slot: 8
> Variable: table (line 482 of fs/select.c) in Slot: 7
>
> Actual:
>
> Variable: stack_fds (line 634 of fs/select.c) in Slot: 3
> Variable: table (line 482 of fs/select.c) in Slot: 2
I think we just print out whatever was in the debug info for the stack slot... maybe it's stale? could just be flat out wrong too. I'll have to take a look.
> What does `Fixed` mean?
FrameInfo has a notion of a "Fixed" slot. From `MachineFrameInfo::CreateFixedObject`'s docstring `"All fixed objects should be created before other objects are created for efficiency. By default, fixed objects are not pointed to by LLVM IR values. This returns an index with a negative value."`
I figured that may be important for people to know/see, so I left it in. It doesn't mean much to me though, and I've thought about dropping it.
> What does it mean for there to be a stack slot that's not a `Spill`, but not allocated to a particular variable?
One weird thing I noticed when I was testing was that Clang was behaving like the default opt level was no longer `-O2` but was `-O0`. So maybe that's related? In that case maybe its dead, but because optimization didn't run, it's been preserved.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135488/new/
https://reviews.llvm.org/D135488
More information about the cfe-commits
mailing list