Issue 148052
Summary Bug in SimplifyCFG causes ICE
Labels new issue
Assignees
Reporter sivadeilra
    This minimal Rust code causes a failure when the `simplifycfg` pass is enabled:

```rust
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.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to