-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Avoid unnecessary allocas for indirect function arguments #44573
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
LGTM. r? @michaelwoerister |
📌 Commit ed7a7cf has been approved by |
Avoid unnecessary allocas for indirect function arguments The extra alloca was only necessary because it made LLVM implicitly handle the necessary deref to get to the actual value. The same happens for indirect arguments that have the byval attribute. But the Rust ABI does not use the byval attribute and so we need to manually add the deref operation to the debuginfo.
This likely caused rollup #44649 to fail with the following error on
( |
⌛ Testing commit ed7a7cf with merge ee179583d630a07cf0009739c6edbc61ada961a8... |
@bors r- |
@bors retry |
Turns out leaving LLVM assertions disabled isn't a good idea when working with LLVM. |
Is there anything we can do about this? Or does this just not work in the general case? |
Looks like an LLVM bug which is only triggered by this change. The jump threading pass duplicates an dbg.declare intrinsic, causing the same fragment to be declared twice and triggering the assertion. I asked on the LLVM ML about it. http://lists.llvm.org/pipermail/llvm-dev/2017-September/117575.html |
@dotdash It wouldn't be the first time LLVM mangles non-trivial debuginfo annotations. |
@dotdash ❤️ |
For triage clarity, where is this up to? Is there a patch making its way upstream (and if so, is there a link to the LLVM phabricator so we can track it)? |
Sorry, I've been unable to get back to this earlier. Upstream patch is at https://reviews.llvm.org/D38540 |
Updated to include the necessary LLVM update and added a second commit to avoid even more copies and fix a debug info oddity/bug. |
b18ed29
to
43c4589
Compare
☔ The latest upstream changes (presumably #45162) made this pull request unmergeable. Please resolve the merge conflicts. |
Rebased and backed out the commit that was failing earlier. Should be good to go now. |
src/rustllvm/llvm-rebuild-trigger
Outdated
@@ -1,4 +1,4 @@ | |||
# If this file is modified, then llvm will be (optionally) cleaned and then rebuilt. | |||
# The actual contents of this file do not matter, but to trigger a change on the | |||
# build bots then the contents should be changed so git updates the mtime. | |||
2017-07-18 | |||
2017-10-10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an LLVM rebuild race.
r+ with the llvm rebuild trigger removed - it is not needed any more because someone else updated our LLVM. |
👍 |
The extra alloca was only necessary because it made LLVM implicitly handle the necessary deref to get to the actual value. The same happens for indirect arguments that have the byval attribute. But the Rust ABI does not use the byval attribute and so we need to manually add the deref operation to the debuginfo.
@bors r=arielb1 |
📌 Commit 6bfecd4 has been approved by |
Avoid unnecessary allocas for indirect function arguments The extra alloca was only necessary because it made LLVM implicitly handle the necessary deref to get to the actual value. The same happens for indirect arguments that have the byval attribute. But the Rust ABI does not use the byval attribute and so we need to manually add the deref operation to the debuginfo.
☀️ Test successful - status-appveyor, status-travis |
The extra alloca was only necessary because it made LLVM implicitly
handle the necessary deref to get to the actual value. The same happens
for indirect arguments that have the byval attribute. But the Rust ABI
does not use the byval attribute and so we need to manually add the
deref operation to the debuginfo.