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

LLVM ERROR compiling Clap on 1.17.0 Nightly #40214

Closed
leonardo-m opened this issue Mar 2, 2017 · 15 comments
Closed

LLVM ERROR compiling Clap on 1.17.0 Nightly #40214

leonardo-m opened this issue Mar 2, 2017 · 15 comments
Assignees
Labels
P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@leonardo-m
Copy link

As reported here:
https://users.rust-lang.org/t/mandel-rust-v0-4/7481/3

Compiling this little project:
https://github.com/willi-kappler/mandel-rust

On x86_64-pc-windows-gnu, rustc 1.17.0-nightly, 691eba1 2017-03-01:

Instruction does not dominate all uses!
%27 = load i32, i32* %26, !range !2
%71 = icmp eq i32 %27, 60
LLVM ERROR: Broken function found, compilation aborted!
error: Could not compile clap.

Further notes:

I can confirm this on MacOS and Linux. Stable and beta ran fine, but nightly has problems on both platforms

@alexcrichton alexcrichton added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Mar 2, 2017
@brson brson added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. P-high High priority I-nominated labels Mar 9, 2017
@TimNN
Copy link
Contributor

TimNN commented Mar 9, 2017

Only happens with --release for me on macOS.

@nagisa
Copy link
Member

nagisa commented Mar 9, 2017

First bad: 1572bf104 2017-02-25
Last good: 08230775a 2017-02-24

Changes

@TimNN
Copy link
Contributor

TimNN commented Mar 9, 2017

Note that while the error does not occur when everything is compiled in debug mode, it does occur when clap itself is compiled with -Copt-level=0 but all the dependencies are -Copt-level=3.

@nagisa
Copy link
Member

nagisa commented Mar 9, 2017

It also sounds a lot like an LLVM bug, since the issue happens during LLVM passes – should check if LLVM 4.0 works or not. Us giving LLVM more information is most likely the trigger.

My bad! It is us who are generating bad IR!

@TimNN
Copy link
Contributor

TimNN commented Mar 9, 2017

@nagisa: This also fails with LLVM 4.0

@nagisa
Copy link
Member

nagisa commented Mar 9, 2017

Minimal-ish reproducer:

pub fn name(c: char) -> char {
    while let Some(c) = Some('[') {
        break;
    }
    c
}

Another interesting case is

    while let Some(c) = Some('[') {
    }
    c

Which ICEs:

error: internal compiler error: /checkout/src/librustc_trans/mir/operand.rs:189: use of _8 before def

This points pretty squarely on the normalize breaks PR.

@nagisa
Copy link
Member

nagisa commented Mar 9, 2017

cc @cramertj

@nikomatsakis
Copy link
Contributor

cc me

@nikomatsakis nikomatsakis self-assigned this Mar 9, 2017
@cramertj
Copy link
Member

cramertj commented Mar 9, 2017

Is this a dup of #40235? (Fixed in #40242)

@nagisa
Copy link
Member

nagisa commented Mar 10, 2017 via email

@nagisa
Copy link
Member

nagisa commented Mar 10, 2017

Reproduced, rather. I recommend trying to re-reproduce.

@cramertj
Copy link
Member

cramertj commented Mar 10, 2017

@nagisa Doing that now. The easy way to check if you have the bugfix from #40242 is to see if this tries to compile (it did before the bugfix, but not after):

pub fn name(c: char) -> char {
    while let Some(t) = Some('[') {
        break;
    }
    t
}

@nagisa
Copy link
Member

nagisa commented Mar 11, 2017

Seems to be fixed in master, so all we need is a nightly release (our current is from 03-03)

@cramertj
Copy link
Member

That was what I found, too. Sorry, forgot to post my results.

@steveklabnik
Copy link
Member

#40214 (comment) does not reproduce on the current nightly. closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants