Skip to content

LLVM assertion with 16 codegen units and ThinLTO #45131

Closed

Description

@Luthaf

Compiling the latest master of soa-derive with 16 codegen units and thinLTO activated makes the compiler hit an LLVM assertion:

$ RUSTFLAGS='-C codegen-units=16 -Z thinlto' cargo +nightly build --release --verbose
       Fresh unicode-xid v0.0.4
       Fresh quote v0.3.15
   Compiling syn v0.10.8
     Running `rustc --crate-name syn /home/guillaume/.cargo/registry/src/github.life-white.uk-1ecc6299db9ec823/syn-0.10.8/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg 'feature="default"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="quote"' --cfg 'feature="unicode-xid"' -C metadata=119c35ede84429ac -C extra-filename=-119c35ede84429ac --out-dir /home/guillaume/perso/lumol/soa-derive/target/release/deps -L dependency=/home/guillaume/perso/lumol/soa-derive/target/release/deps --extern quote=/home/guillaume/perso/lumol/soa-derive/target/release/deps/libquote-fdddc1cdae0a2803.rlib --extern unicode_xid=/home/guillaume/perso/lumol/soa-derive/target/release/deps/libunicode_xid-e1922fe19127ad04.rlib --cap-lints allow -C codegen-units=16 -Z thinlto`
rustc: /checkout/src/llvm/lib/Transforms/Scalar/GVN.cpp:1933: bool llvm::GVN::replaceOperandsWithConsts(llvm::Instruction*) const: Assertion `!isa<Constant>(Operand) && "Replacing constants with constants is invalid"' failed.
error: Could not compile `syn`.

Caused by:
  process didn't exit successfully: `rustc --crate-name syn /home/guillaume/.cargo/registry/src/github.life-white.uk-1ecc6299db9ec823/syn-0.10.8/src/lib.rs --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg feature="default" --cfg feature="parsing" --cfg feature="printing" --cfg feature="quote" --cfg feature="unicode-xid" -C metadata=119c35ede84429ac -C extra-filename=-119c35ede84429ac --out-dir /home/guillaume/perso/lumol/soa-derive/target/release/deps -L dependency=/home/guillaume/perso/lumol/soa-derive/target/release/deps --extern quote=/home/guillaume/perso/lumol/soa-derive/target/release/deps/libquote-fdddc1cdae0a2803.rlib --extern unicode_xid=/home/guillaume/perso/lumol/soa-derive/target/release/deps/libunicode_xid-e1922fe19127ad04.rlib --cap-lints allow -C codegen-units=16 -Z thinlto` (signal: 6, SIGABRT: process abort signal)

The assertion error appears when compiling syn, but I could not reproduce with the syn crate by itself.

Meta

$ rustc +nightly -vV      
rustc 1.22.0-nightly (150b625a0 2017-10-08)
binary: rustc
commit-hash: 150b625a07f135d0a5e1693adf2b14315709779e
commit-date: 2017-10-08
host: x86_64-unknown-linux-gnu
release: 1.22.0-nightly
LLVM version: 4.0

Activity

  1. leoyvens commented on Oct 9, 2017

    @leoyvens
    Contributor
  2. alexcrichton commented on Oct 9, 2017

    @alexcrichton
    Member

    Thanks for the report! I'll try to investigate soon

  3. saethlin commented on Oct 9, 2017

    @saethlin
    Member

    Same error comes out of the crate python3-sys.

         Running `rustc --crate-name build_script_build /home/ben/.cargo/registry/src/github.life-white.uk-1ecc6299db9ec823/python3-sys-0.1.3/build.rs --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="default"' --cfg 'feature="extension-module"' --cfg 'feature="python-3"' -C metadata=60c44052e847b67b -C extra-filename=-60c44052e847b67b --out-dir /home/ben/rust-lather/target/release/build/python3-sys-60c44052e847b67b -L dependency=/home/ben/rust-lather/target/release/deps --extern regex=/home/ben/rust-lather/target/release/deps/libregex-6bf8361efa00f7a6.rlib --cap-lints allow -Ccodegen-units=4 -C target-cpu=native -C codegen-units=32 -Z thinlto`
    rustc: /checkout/src/llvm/lib/Transforms/Scalar/GVN.cpp:1933: bool llvm::GVN::replaceOperandsWithConsts(llvm::Instruction*) const: Assertion `!isa<Constant>(Operand) && "Replacing constants with constants is invalid"' failed.
    error: Could not compile `python3-sys`.
    
    rustc 1.22.0-nightly (150b625a0 2017-10-08)
    binary: rustc
    commit-hash: 150b625a07f135d0a5e1693adf2b14315709779e
    commit-date: 2017-10-08
    host: x86_64-unknown-linux-gnu
    release: 1.22.0-nightly
    LLVM version: 4.0
    
  4. added
    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
    C-bugCategory: This is a bug.
    on Oct 10, 2017
  5. alexcrichton commented on Oct 10, 2017

    @alexcrichton
    Member

    I've opened up an upstream bug for this as well as a fix, and I'll backport this to our branch once it lands.

  6. added a commit that references this issue on Oct 11, 2017
    a2aba79
  7. added a commit that references this issue on Oct 13, 2017
    64cc5ec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions