-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Labels
crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]llvm:transforms
Description
This minimal Rust code causes a failure when the simplifycfg
pass is enabled:
pub fn repro_func(shapes: &mut [ShapeInfo<ReproShape>]) {
repro_generic::<ReproShape>(shapes);
}
#[derive(Clone)]
pub struct ShapeInfo<S> {
pub shape: S,
}
#[derive(Default, Copy, Clone)]
pub enum ReproShape {
#[default]
A = 0,
B = 1,
}
pub(crate) fn repro_generic<S: Default + Clone>(shapes: &mut [ShapeInfo<S>]) {
shapes[0] = shapes[1].clone();
shapes[1].shape = Default::default();
}
When this is compiled with these Rust args:
rustc \
--emit=llvm-ir \
--crate-name=repro \
--edition=2021 \
repro.rs \
--crate-type=lib \
--out-dir=out \
--target=x86_64-pc-windows-msvc \
-Cno-prepopulate-passes
it produces repro.ll
. Rust normally enables simplifycfg
by default, so I've disabled all passes in this repro. You can manually reproduce the problem by running opt --passes=simplifycfg repro.ll
.
I tried to attach repro.ll
, but GitHub rejects *.ll
files. I'll create a repro PR.
Metadata
Metadata
Assignees
Labels
crashPrefer [crash-on-valid] or [crash-on-invalid]Prefer [crash-on-valid] or [crash-on-invalid]llvm:transforms