Skip to content

LLVM ERROR compiling Clap on 1.17.0 Nightly #40214

@leonardo-m

Description

@leonardo-m

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

Activity

added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
P-highHigh priority
on Mar 9, 2017
TimNN

TimNN commented on Mar 9, 2017

@TimNN
Contributor

Only happens with --release for me on macOS.

nagisa

nagisa commented on Mar 9, 2017

@nagisa
Member

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

Changes

TimNN

TimNN commented on Mar 9, 2017

@TimNN
Contributor

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

nagisa commented on Mar 9, 2017

@nagisa
Member

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

TimNN commented on Mar 9, 2017

@TimNN
Contributor

@nagisa: This also fails with LLVM 4.0

nagisa

nagisa commented on Mar 9, 2017

@nagisa
Member

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

nagisa commented on Mar 9, 2017

@nagisa
Member
nikomatsakis

nikomatsakis commented on Mar 9, 2017

@nikomatsakis
Contributor

cc me

self-assigned this
on Mar 9, 2017
cramertj

cramertj commented on Mar 9, 2017

@cramertj
Member

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

nagisa

nagisa commented on Mar 10, 2017

@nagisa
Member
nagisa

nagisa commented on Mar 10, 2017

@nagisa
Member

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

cramertj

cramertj commented on Mar 10, 2017

@cramertj
Member

@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

nagisa commented on Mar 11, 2017

@nagisa
Member

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

cramertj

cramertj commented on Mar 11, 2017

@cramertj
Member

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

steveklabnik

steveklabnik commented on Mar 14, 2017

@steveklabnik
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

Metadata

Metadata

Assignees

Labels

P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @steveklabnik@alexcrichton@brson@nikomatsakis@nagisa

      Issue actions

        LLVM ERROR compiling Clap on 1.17.0 Nightly · Issue #40214 · rust-lang/rust