Skip to content

llvm assertion failure when trying to compile sha2 crate for skylake (with llvm+rustc debug assertions) #100834

Closed
@matthiaskrgr

Description

@matthiaskrgr

I have a Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz, so when compiling with -Ctarget-cpu=native this is equivalent to -Ctarget-cpu=skylake.

I have a rustc+llvm that has debug assertions enabled and when I try to compile sha2 v0.10.1 this apparently hits a debug assertion inside llvm:

RUSTFLAGS="-Ctarget-cpu=skylake" RUSTC=/home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/bin/rustc cargo build --release

   Compiling sha2 v0.10.1 (/tmp/sha)
rustc: /home/matthias/vcs/github/rust_debug_assertions/src/llvm-project/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2556: llvm::slpvectorizer::BoUpSLP::TreeEntry *llvm::slpvectorizer::BoUpSLP::newTreeEntry(ArrayRef<llvm::Value *>, TreeEntry::EntryState, Optional<llvm::slpvectorizer::BoUpSLP::ScheduleData *>, const (anonymous namespace)::InstructionsState &, const llvm::slpvectorizer::BoUpSLP::EdgeInfo &, ArrayRef<int>, ArrayRef<unsigned int>): Assertion `!getTreeEntry(V) && "Scalar already in tree!"' failed.
sccache: Compiler killed by signal 6
error: could not compile `sha2`

Caused by:
  process didn't exit successfully: `/home/matthias/.cargo/bin/sccache /home/matthias/vcs/github/rust_debug_assertions/build/x86_64-unknown-linux-gnu/stage1/bin/rustc --crate-name sha2 --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=96ac895c949c4242 -C extra-filename=-96ac895c949c4242 --out-dir /tmp/sha/target/release/deps -L dependency=/tmp/sha/target/release/deps --extern cfg_if=/tmp/sha/target/release/deps/libcfg_if-19e7cc0b6f708960.rmeta --extern cpufeatures=/tmp/sha/target/release/deps/libcpufeatures-60eedbcf432061e3.rmeta --extern digest=/tmp/sha/target/release/deps/libdigest-d6ef0fdeb4fc592a.rmeta -Ctarget-cpu=skylake` (exit status: 254)

This rustc used is built with rustc debug assertions and llvm debug assertions and I noticed this crash during stage 2 of x.py build boostrap.

bootstrap was done with

changelog-seen = 2
[llvm]
download-ci-llvm = false
assertions = true
ninja = true
targets = "X86"
link-jobs = 2
[build]
extended = true
tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"] # + "rust-demangler" if `profiler`
low-priority = true
[install]
[rust]
debug = true
debug-assertions = true
debug-assertions-std = true
overflow-checks = true
overflow-checks-std = true
debuginfo-level = 1
backtrace-on-ice = true
verify-llvm-ir = true
[target.x86_64-unknown-linux-gnu]
[dist]

Metadata

Metadata

Assignees

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions