Skip to content

LLVM assertion with 16 codegen units and ThinLTO #45131

Closed
@Luthaf

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.com-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.com-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

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