-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Instrumentation (-Zinstrument-mcount) broken due to missing LLVM-pass since LLVM13 update #92109
Comments
Manually adding the passes works with all nightly versions I have tested (including the current one):
For 2021-08-22 it also prints said passes. Sometime in between 09-01 and 10-01 the pass is not printed anymore, not sure why.
|
The responsibility for hooking in EntryExitInstrumenterPass moved from LLVM to Clang in https://reviews.llvm.org/D97608. |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
Using I'm not sure if clang generates different code, but I would have expected an inlined function to not contribute to the call count of its parent function. |
In 31a5066, EDIT: Actually from https://reviews.llvm.org/D22666 I think you're right that mcount shouldn't appear in inlined functions. It seems this is an ordering issue of LLVM passes then. |
I reported the inlining / pass ordering issue upstream llvm/llvm-project#52853 (but never got around to fixing it). |
Thanks for the context! According to that thread, it seems completely disabling LTO is a valid workaround. I can verify that. More specifically, If I build my project using:
Then |
…pelines (#92171) Move EntryExitInstrumenter(PostInlining=true) to as late as possible and EntryExitInstrumenter(PostInlining=false) to an early pre-inlining stage (but skip for ThinLTO post-link). This should fix the issues reported in rust-lang/rust#92109 and #52853. These are caused by https://reviews.llvm.org/D97608.
llvm/llvm-project#92171 this should be fixed now? |
I believe it should be fixed, but I did not test it. |
Issue
I tried to compile a generic hello-world binary with the
-Zinstrument-mcount
compiler option.I expected every function-entry to have a call to
mcount()
.Instead, there are no such calls inserted.
Triage
I have triaged the bug, and it first occurred in
nightly-2021-08-22
, the first version with LLVM13.The LLVM-IR still contains the
"instrument-function-entry-inlined"="mcount"
attributes, but the corrosponding llvm-pass is not run anymore.Verbose Versions:
The text was updated successfully, but these errors were encountered: