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 assertion with 16 codegen units and ThinLTO #45131

Closed
Luthaf opened this issue Oct 9, 2017 · 4 comments · Fixed by #45203
Closed

LLVM assertion with 16 codegen units and ThinLTO #45131

Luthaf opened this issue Oct 9, 2017 · 4 comments · Fixed by #45203
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug.

Comments

@Luthaf
Copy link

Luthaf commented Oct 9, 2017

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
@leoyvens
Copy link
Contributor

leoyvens commented Oct 9, 2017

ping @alexcrichton

@alexcrichton
Copy link
Member

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

@saethlin
Copy link
Member

saethlin commented Oct 9, 2017

Same error comes out of the crate python3-sys.

     Running `rustc --crate-name build_script_build /home/ben/.cargo/registry/src/github.com-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

@TimNN TimNN added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. labels Oct 10, 2017
@alexcrichton
Copy link
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.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Oct 11, 2017
This commit updates LLVM with a patch that's landed upstream to fix an assertion
that was tripping when ThinLTO was activated. Unfortunately I wasn't able to get
a reduced test case, but I've tested manually on the affected crates and the
assertion is indeed fixed.

Closes rust-lang#45131
kennytm added a commit to kennytm/rust that referenced this issue Oct 13, 2017
…woerister

rustc: Update LLVM with a ThinLTO fix

This commit updates LLVM with a patch that's landed upstream to fix an assertion
that was tripping when ThinLTO was activated. Unfortunately I wasn't able to get
a reduced test case, but I've tested manually on the affected crates and the
assertion is indeed fixed.

Closes rust-lang#45131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants