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

Add EntryExistInstrumenterPass for -Z instrument-mcount to the pipeline manually for LLVM >= 13. #96238

Closed
wants to merge 5 commits into from

Conversation

luqmana
Copy link
Member

@luqmana luqmana commented Apr 20, 2022

Fixes #92109

@luqmana luqmana requested a review from nikic April 20, 2022 02:24
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 20, 2022
@rust-highfive
Copy link
Collaborator

r? @fee1-dead

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 20, 2022
luqmana added 2 commits April 19, 2022 19:44
Alas, there's no max-llvm-version so we could also test LLVM < 13.
@fee1-dead
Copy link
Member

fee1-dead commented Apr 20, 2022

r? @nikic

(I'm not familiar with LLVM)

@rust-highfive rust-highfive assigned nikic and unassigned fee1-dead Apr 20, 2022
@fee1-dead fee1-dead assigned nikic and unassigned nikic Apr 20, 2022
@nikic
Copy link
Contributor

nikic commented Apr 20, 2022

As we only set instrument-function-entry-inlined, I assume the pre-inline pass is not strictly necessary and just added for the sake of completeness?

@tmiasko
Copy link
Contributor

tmiasko commented Apr 20, 2022

I don't have opinion whether we should land this for now, but I think the issue is ultimately on the LLVM side: llvm/llvm-project#52853

@luqmana
Copy link
Member Author

luqmana commented Apr 20, 2022

As we only set instrument-function-entry-inlined, I assume the pre-inline pass is not strictly necessary and just added for the sake of completeness?

Yea. Mostly trying to keep the same behaviour that was previously handled in LLVM. More-or-less doing the same sorta thing in clang (as per https://reviews.llvm.org/D97608)

@luqmana
Copy link
Member Author

luqmana commented Apr 20, 2022

I don't have opinion whether we should land this for now, but I think the issue is ultimately on the LLVM side: llvm/llvm-project#52853

I think that's the slightly different issue of clang producing misleading results. Rust simply stopped inserting the mcount calls at all, which is what this PR was trying to address. Although, reading that it seems like we might as have the same issue.

@tmiasko
Copy link
Contributor

tmiasko commented Apr 20, 2022

I don't have opinion whether we should land this for now, but I think the issue is ultimately on the LLVM side: llvm/llvm-project#52853

I think that's the slightly different issue of clang producing misleading results. Rust simply stopped inserting the mcount calls at all, which is what this PR was trying to address. Although, reading that it seems like we might as have the same issue.

To my understanding fixing that issue would obviate the need for changes on the Rust side, and obsolete any changes made here, so it might be a preferable direction. Especially that Rust implementation would otherwise have exactly the same problem.

Sorry for just linking the issue without offering an explanation.

@luqmana
Copy link
Member Author

luqmana commented Apr 20, 2022

I don't have opinion whether we should land this for now, but I think the issue is ultimately on the LLVM side: llvm/llvm-project#52853

I think that's the slightly different issue of clang producing misleading results. Rust simply stopped inserting the mcount calls at all, which is what this PR was trying to address. Although, reading that it seems like we might as have the same issue.

To my understanding fixing that issue would obviate the need for changes on the Rust side, and obsolete any changes made here, so it might be a preferable direction. Especially that Rust implementation would otherwise have exactly the same problem.

Sorry for just linking the issue without offering an explanation.

Oh no worries. I did think on first read they meant making those changes on the Clang side but if it involves just doing the work from the backend again, that works too. I guess the question then is is it worth getting something working in the meantime since it has been broken for a couple months now.

@pnkfelix
Copy link
Member

I think we can and should push ahead with the strategy of adding a -Z flag for the short term to cover this functionality.

But I also think it makes a lot of sense to include a pointer to llvm/llvm-project#52853, either in a comment in the code itself, or in the help text for -Z instrument-mcount, so that people at least have some hint that the results they get may suffer from misleading end results.

r+ from me after you make a change along those lines, @luqmana .

@apiraino
Copy link
Contributor

apiraino commented May 26, 2022

Switching to waiting on author to incorporate changes. Feel free to request a review when ready, thanks!

@rustbot label -S-waiting-on-review +S-waiting-on-author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 2, 2022
@bors
Copy link
Contributor

bors commented Jul 27, 2022

☔ The latest upstream changes (presumably #99792) made this pull request unmergeable. Please resolve the merge conflicts.

@cuviper
Copy link
Member

cuviper commented Aug 16, 2022

FYI, #100460 made LLVM 13 the minimum, which should simplify some things here.

@JohnCSimon
Copy link
Member

ping from triage:
@luqmana

Can you please post your status on this PR? There are reviewer comments.

FYI: when a PR is ready for review, send a message containing
@rustbot ready to switch to S-waiting-on-review so the PR is in the reviewer's backlog.

@mati865
Copy link
Contributor

mati865 commented Jan 27, 2023

ping @luqmana

@Dylan-DPC
Copy link
Member

Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks

@Dylan-DPC Dylan-DPC closed this May 13, 2023
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instrumentation (-Zinstrument-mcount) broken due to missing LLVM-pass since LLVM13 update