1; RUN: opt %s -passes='function(scalarizer)' -S -o - | FileCheck %s
2
3; This input caused the scalarizer to replace & erase gathered results when
4; future gathered results depended on them being alive
5
6define dllexport spir_func <4 x i32> @main(float %a) {
7entry:
8  %i = insertelement <4 x float> undef, float %a, i32 0
9  br label %z
10
11y:
12; CHECK: %f.upto0 = insertelement <4 x i32> poison, i32 %b.i0, i32 0
13; CHECK: %f.upto1 = insertelement <4 x i32> %f.upto0, i32 %b.i0, i32 1
14; CHECK: %f.upto2 = insertelement <4 x i32> %f.upto1, i32 %b.i0, i32 2
15; CHECK: %f = insertelement <4 x i32> %f.upto2, i32 %b.i0, i32 3
16  %f = shufflevector <4 x i32> %b, <4 x i32> undef, <4 x i32> zeroinitializer
17  ret <4 x i32> %f
18
19z:
20; CHECK: %b.i0 = bitcast float %a to i32
21  %b = bitcast <4 x float> %i to <4 x i32>
22  br label %y
23}
24