-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Update LLVM to pull in patch that removes extraneous null check. #40914
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// compile-flags: -C no-prepopulate-passes -O |
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.
Don't you want just -O
?
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.
True, left over from copy/paste of copyright preamble and compile-flags. Interestingly most (if not all?) the codegen tests seem to use no-prepopulate-passes.
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.
That's because in most cases we are interested in checking our codegen, not LLVM's optimizations.
5c1ca0a
to
3fb191c
Compare
Well it looks like the test works! (this is failing on the llvm 3.7 builder) I think this may just need a Other than that r=me |
We want to ignore the test on all non-local LLVMs - after all, no public LLVM released yet includes the optimization. |
@alexcrichton @arielb1 Hmm should we just use a version 4.1 and live with it not running for a while or do what a couple other tests seem to do and just specify 3.8? I'm not sure how many are actually in the llvm 3.8 branch. |
I don't particularly care how the test is written. If it gets past the bots and it runs on at least one bot that's all I really care about. |
Distributions use their own LLVM, which does not include our patch. |
I picked up this LLVM update in the beta backport (just did a reset to the current master) and it looks like this may fail during the bootstrap? https://travis-ci.org/rust-lang/rust/jobs/217577161 I'm not 100% sure it's caused by this, but it seems suspicious |
@alexcrichton hmm, i'll give a look into that. |
@alexcrichton I tried building beta and wasn't able to reproduce that failure? |
@luqmana: Did you build with LLVM assertions enabled? Edit: Also, the failure was while building |
@TimNN Aha! I didn't have assertions on. I must've disabled them at some point. Enabling those I was able to reproduce the error @alexcrichton had. I minimized the IR with bugpoint: ; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "bugpoint-output-7eb0c3b.bc"
target triple = "x86_64-unknown-linux-gnu"
%foo = type { %bar*, %baz* }
%bar = type { %bil*, i8*, %baz* }
%bil = type { i32, [0 x i32], [1 x i32] }
%baz = type { i8*, i64 }
define fastcc void @fail_sroa() {
entry-block:
%arg5 = alloca %foo, align 8
%0 = bitcast %foo* %arg5 to i64*
store i64 undef, i64* %0, align 8
%1 = getelementptr inbounds %foo, %foo* %arg5, i64 0, i32 0
%2 = load %bar*, %bar** %1, align 8, !nonnull !0
unreachable
}
!0 = !{} Running it with
But, with LLVM from head the assertion is not triggered. |
@TimNN That'd be great, thanks!
|
I tested this with LLVM 4.0:
|
Someone has to figure out why this causes LLVM assertions and fix that. |
@shepmaster @arielb1 I'll hopefully get to it when I'm done in the next week or two. @TimNN Thanks for testing. Mind pushing a branch somewhere so I can reproduce? |
For the record, a short transcription for irc:
|
☔ The latest upstream changes (presumably #40123) made this pull request unmergeable. Please resolve the merge conflicts. |
LLVM 4.0 has just landed. Can you make it work with that? |
@luqmana are you going to be doing this? Should I fix this PR myself? |
@arielb1 I was planning to get to it soon but you're also welcome to proceed. I did have a bit of time the other day and rebased on the llvm4.0 branch, but ended up finding that the extra null check reappeared. I didn't have time to investigate unfortunately. |
I'll take up this PR myself. |
@arielb1 Any update on taking this PR up yourself? |
status: waiting until I get on top of regressions etc. |
Note: When redoing the backport, if someone could check if #38349 is fixed as well that would be great. |
status: currently dealing with a few more important backlog items. I'll get to this. |
Hi @arielb1, just want to make sure this hasn't dropped off the bottom of your backlog :) |
Actually I'm doing some LLVM stuff right now, so it might skip upwards. I'm just busy with some personal stuff. |
FWIW the upstream version of this patch seems to cause an assertion failure in LLVM for me when compiling libcore [1]. Someone else (@vadimcn?) has already reported this upstream earlier and minified it to SROA incorrectly putting PS: I'd report these findings on LLVM bug, but I don't have an account. Would be great if someone could pass it on. [1] To clarify, this is with an LLVM fork that tracks upstream much more closely than we do. Edit: Ha, I only just noticed that this assertion failure has been seen here too 😅 I somehow missed that and thought the problem was something different. |
Let's see how that goes. |
This patch does not actually help the original case - now it's EarlyCSE that is eating our metadata. It turns
Into
That's... odd. Why is it eating our assumptions? |
Minified: ; RUN: opt -S -early-cse < %s | FileCheck %s
declare i1 @food()
declare void @llvm.assume(i1)
; CHECK-LABEL: define void @hungry()
define void @hungry() {
entry-block:
%0 = call i1 @food()
%1 = xor i1 %0, true
; CHECK: call void @llvm.assume
call void @llvm.assume(i1 %1)
ret void
} Passes on 3.9, fails on 4.0. |
The LLVM assertion in https://bugs.llvm.org/show_bug.cgi?id=32902 is fixed by my https://reviews.llvm.org/D34285, which is awaiting review by LLVM. |
status: still waiting for LLVM review by @chandlerc. |
@chandlerc had committed llvm-mirror/llvm@7df0651, so this is fixed on LLVM trunk! I'll backport this to our LLVM tomorrow. |
This is waiting on rust-lang/llvm#90. |
rust-lang/llvm#90 has landed. |
superseded by #43026. |
Fixes #37945.