-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Improve the LLVM IR we generate for trivial functions, especially #[naked] ones. #40367
Conversation
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
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.
LGTM.
bug!("cannot generate operand from rvalue {:?}", rvalue); | ||
|
||
// According to `rvalue_creates_operand`, only ZST | ||
// aggregate rvalues are allowed to be operands. |
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.
(debug) assertion would be nice here. It is not unlikely for somebody to edit some interaction between some rvalue_creates_operand
and this function in a wrong way and an assertion here would catch it.
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.
I had one! It's now in OperandRef::new_zst
.
@bors r=nagisa |
📌 Commit df60044 has been approved by |
🔒 Merge conflict |
@bors: retry |
Improve the LLVM IR we generate for trivial functions, especially #[naked] ones. These two small changes fix edef1c/libfringe#68: * Don't emit ZST allocas, such as when returning `()` * Don't emit a branch from LLVM's entry block to MIR's `START_BLOCK` unless needed * That is, if a loop branches back to it, although I'm not sure that's even valid MIR
Improve the LLVM IR we generate for trivial functions, especially #[naked] ones. These two small changes fix edef1c/libfringe#68: * Don't emit ZST allocas, such as when returning `()` * Don't emit a branch from LLVM's entry block to MIR's `START_BLOCK` unless needed * That is, if a loop branches back to it, although I'm not sure that's even valid MIR
df60044
to
d8ca084
Compare
@bors: r=nagisa |
📌 Commit d8ca084 has been approved by |
Improve the LLVM IR we generate for trivial functions, especially #[naked] ones. These two small changes fix edef1c/libfringe#68: * Don't emit ZST allocas, such as when returning `()` * Don't emit a branch from LLVM's entry block to MIR's `START_BLOCK` unless needed * That is, if a loop branches back to it, although I'm not sure that's even valid MIR
Improve the LLVM IR we generate for trivial functions, especially #[naked] ones. These two small changes fix edef1c/libfringe#68: * Don't emit ZST allocas, such as when returning `()` * Don't emit a branch from LLVM's entry block to MIR's `START_BLOCK` unless needed * That is, if a loop branches back to it, although I'm not sure that's even valid MIR
Rollup of 38 pull requests - Successful merges: #39202, #39820, #39918, #39921, #40092, #40146, #40199, #40225, #40239, #40257, #40259, #40261, #40277, #40278, #40287, #40297, #40311, #40315, #40319, #40324, #40336, #40340, #40344, #40345, #40367, #40369, #40372, #40373, #40379, #40385, #40386, #40389, #40400, #40404, #40410, #40422, #40423, #40424 - Failed merges: #40220, #40329, #40426
Rollup of 38 pull requests - Successful merges: #39202, #39820, #39918, #39921, #40092, #40146, #40199, #40225, #40239, #40257, #40259, #40261, #40277, #40278, #40287, #40297, #40311, #40315, #40319, #40324, #40336, #40340, #40344, #40345, #40367, #40369, #40372, #40373, #40379, #40385, #40386, #40389, #40400, #40404, #40410, #40422, #40423, #40424 - Failed merges: #40220, #40329, #40426
Improve the LLVM IR we generate for trivial functions, especially #[naked] ones. These two small changes fix edef1c/libfringe#68: * Don't emit ZST allocas, such as when returning `()` * Don't emit a branch from LLVM's entry block to MIR's `START_BLOCK` unless needed * That is, if a loop branches back to it, although I'm not sure that's even valid MIR
Eh, @bors r- Better that @eddyb add a tester for i686-gnu-noopt. Test failure:
|
☔ The latest upstream changes (presumably #39628) made this pull request unmergeable. Please resolve the merge conflicts. |
Looks like ./x.py test --stage 1 src/test/debuginfo --test-args macro-stepping --target i686-unknown-linux-gnu |
I've gradually transformed the LLVM IR from Rust to match the LLVM IR from Clang. --- test.c.ll 2017-04-12 15:58:31.236264978 +0000
+++ test.rs.ll 2017-04-12 15:59:02.302421857 +0000
@@ -29 +29 @@
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.1 (tags/RELEASE_391/final)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "rustc version 1.18.0-dev (57ca703dc 2017-04-11)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) EDIT: Shorter diff, |
So it turns out that LLVM produces this (for a main:
.loc 1 5 0
pushl %ebp
movl %esp, %ebp
.loc 1 6 5 prologue_end
subl $8, %esp
calll included GDB is capable of determining that the last instruction in the prologue is |
@bors r=nagisa |
📌 Commit 9b5c577 has been approved by |
⌛ Testing commit 9b5c577 with merge 3ee3088... |
💔 Test failed - status-travis |
@bors retry
|
⌛ Testing commit 9b5c577 with merge 8e25752... |
💔 Test failed - status-travis |
… On Wed, Apr 12, 2017 at 7:28 PM, bors ***@***.***> wrote:
💔 Test failed - status-travis
<https://travis-ci.org/rust-lang/rust/builds/221539796>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#40367 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95HcODQfcDRwRRoWPvfYU-V0dvhrEks5rvWwmgaJpZM4MXIqb>
.
|
⌛ Testing commit 9b5c577 with merge 1470a1a... |
💔 Test failed - status-travis |
Musl segfault: @bors retry |
Improve the LLVM IR we generate for trivial functions, especially #[naked] ones. These two small changes fix edef1c/libfringe#68: * Don't emit ZST allocas, such as when returning `()` * Don't emit a branch from LLVM's entry block to MIR's `START_BLOCK` unless needed * That is, if a loop branches back to it, although I'm not sure that's even valid MIR
☀️ Test successful - status-appveyor, status-travis |
These two small changes fix edef1c/libfringe#68:
()
START_BLOCK
unless needed