-
Notifications
You must be signed in to change notification settings - Fork 13.4k
LTO miscompilation on some rust<->C/C++ calls #58307
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
Closed
Milestone
Comments
@tru can this be added to the 15.0.4 milestone? |
When the fix has landed in main. Run the cherry pick comment command to queue up a pick to the release branch. |
/cherry-pick 86e57e6 |
/branch llvm/llvm-project-release-prs/issue58307 |
/pull-request llvm/llvm-project-release-prs#199 |
tru
pushed a commit
that referenced
this issue
Oct 24, 2022
…al is involved. Fixes #58307 Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D135738 (cherry picked from commit 86e57e6)
sid8123
pushed a commit
to sid8123/llvm-project
that referenced
this issue
Oct 25, 2022
…al is involved. Fixes llvm#58307 Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D135738
virnarula
pushed a commit
to virnarula/llvm-project
that referenced
this issue
Nov 2, 2022
…al is involved. Fixes llvm#58307 Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D135738
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Rust compiler doesn't create IR identical to clang for the same ABI: rust-lang/rust#102174. When doing cross-language LTO, this leads LLVM to do the wrong things when it inlines those calls. This is a regression from 6c8adc5.
STR:
foo.ll
(derived from rustc output, see further below for original source)bar.ll
(derived from clang output, see further below for original source)llvm-as foo.ll
llvm-as bar.ll
llvm-lto foo.bc bar.bc -filetype=asm -exported-symbol=bar -o -
movl (%eax), %eax
shouldn't be there, it's dereferencing something that is not originally a pointer.What happens is that
InstCombine
creates the mess by handling the i32->byval conversion as a i32->ptr conversion:It should be something like
instead of
inttoptr
, or it should bail out (i.e. what happened before 6c8adc5).Patch for the latter incoming.
Original source:
foo.rs
bar.c
The text was updated successfully, but these errors were encountered: