[llvm] [InstCombine] Pull extract through broadcast (PR #143380)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 25 01:56:36 PDT 2025


https://github.com/RKSimon approved this pull request.

LGTM @nikic any more comments? whether we're happy with out of bounds extraction from a known splat (possibly with undef shuffle indices) seems to be the only outstanding issue

```
define i4 @src(i4 %x) {
  %v = insertelement <4 x i4> poison, i4 %x, i32 0
  %s = shufflevector <4 x i4> %v, <4 x i4> poison, 0, 0, 4294967295, 0
  %e = extractelement <4 x i4> %s, i32 4294967295
  ret i4 %e
}
=>
define i4 @tgt(i4 %x) {
  ret i4 %x
}
Transformation seems to be correct!
```

https://github.com/llvm/llvm-project/pull/143380


More information about the llvm-commits mailing list