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

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 08:16:50 PDT 2025


================
@@ -91,10 +91,7 @@ define i8 @extractelement_bitcast_insert_extra_use_bitcast(<vscale x 2 x i32> %a
 
 define i32 @extractelement_shuffle_maybe_out_of_range(i32 %v) {
 ; CHECK-LABEL: @extractelement_shuffle_maybe_out_of_range(
-; CHECK-NEXT:    [[IN:%.*]] = insertelement <vscale x 4 x i32> poison, i32 [[V:%.*]], i64 0
-; CHECK-NEXT:    [[SPLAT:%.*]] = shufflevector <vscale x 4 x i32> [[IN]], <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
-; CHECK-NEXT:    [[R:%.*]] = extractelement <vscale x 4 x i32> [[SPLAT]], i64 4
-; CHECK-NEXT:    ret i32 [[R]]
----------------
agorenstein-nvidia wrote:

This is analogous to the other comment; it *may* be that the `extractelement ... i32 4` is out of bounds (when `vscale=1`, so to speak). However, we are able to know that any valid index into `%splat` must be `%v`, so we just return `%v`. So, similar questions as the other comment.

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


More information about the llvm-commits mailing list