Repository: rust
Issue: LLVM ERROR: Broken function found -- Invalid shufflevector operands
Labels: A-LLVM,I-ICE,E-needs-test,T-compiler,C-bug,O-AArch64

### Code

Sorry for the large snippet, I've tried to minimize it as much as possible, but at this point changing anything "fixes" the crash.

```Rust
#[derive(Clone, Copy)]
struct Color(u8, u8, u8);

const WHITE: Color = Color(0xCF, 0xCE, 0xC1);
const YELLOW: Color = Color(0xFF, 0xFF, 0x00);

struct Tile {
    glyph: char,
    color: Color,
}

struct BufferRenderer {
    rows: i32,
    cols: i32,
    buffer: Vec<Tile>,
}

impl BufferRenderer {
    fn render(&mut self, col: i32, row: i32, glyph: char, color: Color) {
        let idx = (row * self.cols + col) as usize;
        let tile = &mut self.buffer[idx];
        tile.glyph = glyph;
        tile.color = color;
    }
}

fn render_some_lines(
    renderer: &mut BufferRenderer,
    x: i32,
    y: i32,
    width: i32,
    height: i32,
    color: Color,
) {
    renderer.render(x, y, '╭', color);
    renderer.render(x + width, y, '╮', color);
    renderer.render(x, y + height, '╰', color);
    renderer.render(x + width, y + height, '╯', color);
    for xi in x + 1..x + width {
        renderer.render(xi, y, '─', color);
        renderer.render(xi, y + height, '─', color);
    }
}

trait State {
    fn render(&self, renderer: &mut BufferRenderer);
}

struct App {}

impl State for App {
    fn render(&self, renderer: &mut BufferRenderer) {
        render_some_lines(renderer, 0, 0, renderer.cols - 1, renderer.rows - 1, WHITE);
        render_some_lines(renderer, 0, 0, 1, 1, YELLOW);
    }
}
```

### Meta

`rustc --version --verbose`:
```
rustc 1.66.0 (69f9c33d7 2022-12-12)
binary: rustc
commit-hash: 69f9c33d71c871fc16ac445211281c6e7a340943
commit-date: 2022-12-12
host: aarch64-apple-darwin
release: 1.66.0
LLVM version: 15.0.2
```

### Error output

The crash reproduces only when building in `--release` mode, works fine with `--debug`.

```
❯ cargo build --release --verbose
   Compiling rust-ice-shufflevector v0.1.0 (/Users/werat/src/rust-ice-shufflevector)
     Running `rustc --crate-name rust_ice_shufflevector --edition=2021 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 -C metadata=54d661526036fc3e -C extra-filename=-54d661526036fc3e --out-dir /Users/werat/src/rust-ice-shufflevector/target/release/deps -L dependency=/Users/werat/src/rust-ice-shufflevector/target/release/deps`
Invalid shufflevector operands!
  %127 = shufflevector <4 x i32> <i32 9472, i32 9472, i32 9472, i32 9472>, <4 x i24> %126, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
in function _ZN22rust_ice_shufflevector17render_some_lines17h25dd636635bca54eE
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `rust-ice-shufflevector`
```

<details><summary><strong>Backtrace</strong></summary>
<p>

Unfortunately `RUST_BACKTRACE=1` doesn't do anything in this case.

```
❯ RUST_BACKTRACE=1 cargo build --release
   Compiling rust-ice-shufflevector v0.1.0 (/Users/werat/src/rust-ice-shufflevector)
Invalid shufflevector operands!
  %127 = shufflevector <4 x i32> <i32 9472, i32 9472, i32 9472, i32 9472>, <4 x i24> %126, <8 x i32> <i32 0, i32 4, i32 1, i32 5, i32 2, i32 6, i32 3, i32 7>
in function _ZN22rust_ice_shufflevector17render_some_lines17h25dd636635bca54eE
LLVM ERROR: Broken function found, compilation aborted!
error: could not compile `rust-ice-shufflevector`
```

</p>
</details>