blob: 5c4836a44df28438f0c8e4b31f0b349cc8397b6b [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -passes=vector-combine -S %s | FileCheck %s
; PR218724: Out-of-bounds extractelement index should not crash.
; An out-of-bounds extractelement produces poison; scalarizeExtExtract must
; bail out rather than computing a shift amount that overflows the packed type.
define i16 @PR218724() {
; CHECK-LABEL: define i16 @PR218724() {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[I0:%.*]] = zext <2 x i8> zeroinitializer to <2 x i16>
; CHECK-NEXT: [[I1:%.*]] = extractelement <2 x i16> [[I0]], i32 25194
; CHECK-NEXT: ret i16 [[I1]]
;
entry:
%i0 = zext <2 x i8> zeroinitializer to <2 x i16>
%i1 = extractelement <2 x i16> %i0, i32 25194
ret i16 %i1
}