Open
Description
I started by looking at rust-lang/rust#139355 but it looks like the root cause can be produce with much less Rust code: https://godbolt.org/z/4Kv5Gbdse
As far as I can tell, things go wrong twice. SROA tries to splat the undef i8, but it generates a generic sequence of instructions in the process instead of just an undef of the target type. Then EarlyCSE sees the splat and replaces it with a 0.
I have a candidate fix for this, though I'm a bit of a novice at working on LLVM.