Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wframe-larger-than no longer shows information about spills/variables #1894

Closed
nathanchance opened this issue Jul 27, 2023 · 4 comments
Closed
Labels
-Wframe-larger-than= [Regression] llvm This was previously working, but the toolchain has regressed. wontfix This will not be worked on

Comments

@nathanchance
Copy link
Member

While investigating a recent -Wframe-larger-than warning, I noticed that on recent tip of tree LLVM builds, we no longer see information about the spills/variables that were added by llvm/llvm-project@2e1e2f5.

LLVM 16.0.6:

fs/smb/client/sess.c:160:5: warning: stack frame size (1152) exceeds limit (1024) in 'cifs_try_adding_channels' [-Wframe-larger-than]
int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
    ^
412/1152 (35.76%) spills, 740/1152 (64.24%) variables
1 warning generated.

LLVM 17.0.0:

fs/smb/client/sess.c:160:5: warning: stack frame size (1152) exceeds limit (1024) in 'cifs_try_adding_channels' [-Wframe-larger-than]
  160 | int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses)
      |     ^
1 warning generated.

It looks like llvm/llvm-project@945f6e6 removed this, which basically defeats the purpose of llvm/llvm-project@2e1e2f5 from what I can tell... While we can still get this information from KCFLAGS=-Rpass-analysis=stack-frame-layout, I think it is helpful for other non-compiler developers to immediately see where the high stack usage comes from, as spills typically indicate something up with inlining or other internal compiler decisions whereas variables are more indicative of something wrong with the code.

@nathanchance nathanchance added -Wframe-larger-than= [Regression] llvm This was previously working, but the toolchain has regressed. labels Jul 27, 2023
@nathanchance
Copy link
Member Author

There was some post-commit discussion on Phabricator: https://reviews.llvm.org/rG945f6e65be0d20b3446e7c1537c64151de618af4

@nickdesaulniers
Copy link
Member

cc @ilovepi

@nickdesaulniers
Copy link
Member

This may be working as intended.

Though I will note from this example there are cases where -Rpass-analysis=stack-frame-layout is not able to inform what variable is in what stack slot. In contrast, frame-larger-than can spot this info from the debug info.

@nickdesaulniers nickdesaulniers added the wontfix This will not be worked on label Aug 17, 2023
@nickdesaulniers
Copy link
Member

nickdesaulniers commented Aug 17, 2023

I get 1 variable info for -Rpass-analysis=stack-frame-layout when using --target=arm-linux-gnueabihf and many unknown stack slots...example:

...
Offset: [SP-40], Type: Variable, Align: 4, Size: 4
Offset: [SP-44], Type: Protector, Align: 4, Size: 4
Offset: [SP-56], Type: Variable, Align: 8, Size: 8
    res @ ./drivers/gpu/drm/amd/amdgpu/../display/dc/inc/bw_fixed.h:128
Offset: [SP-64], Type: Variable, Align: 8, Size: 8
Offset: [SP-72], Type: Variable, Align: 8, Size: 8
Offset: [SP-80], Type: Variable, Align: 8, Size: 8
Offset: [SP-84], Type: Spill, Align: 4, Size: 4
Offset: [SP-88], Type: Spill, Align: 4, Size: 4
Offset: [SP-92], Type: Spill, Align: 4, Size: 4
Offset: [SP-96], Type: Spill, Align: 4, Size: 4
Offset: [SP-100], Type: Spill, Align: 4, Size: 4
Offset: [SP-104], Type: Spill, Align: 4, Size: 4
Offset: [SP-108], Type: Spill, Align: 4, Size: 4
Offset: [SP-112], Type: Spill, Align: 4, Size: 4
Offset: [SP-116], Type: Spill, Align: 4, Size: 4
Offset: [SP-120], Type: Spill, Align: 4, Size: 4
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Wframe-larger-than= [Regression] llvm This was previously working, but the toolchain has regressed. wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants