1 ; RUN: opt < %s -constprop -S | FileCheck %s
3 %struct = type { i32, [4 x i8] }
5 define %struct @test1() {
6 %A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i32 1, 0
9 ; CHECK: ret %struct { i32 1, [4 x i8] c"foo\00" }
12 define %struct @test2() {
13 %A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i8 1, 1, 2
15 ; CHECK-LABEL: @test2(
16 ; CHECK: ret %struct { i32 2, [4 x i8] c"fo\01\00" }
19 define [3 x %struct] @test3() {
20 %A = insertvalue [3 x %struct] [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], i32 -1, 1, 0
22 ; CHECK-LABEL: @test3(
23 ; CHECK:ret [3 x %struct] [%struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 -1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" }]
26 define %struct @zeroinitializer-test1() {
27 %A = insertvalue %struct zeroinitializer, i32 1, 0
29 ; CHECK: @zeroinitializer-test1
30 ; CHECK: ret %struct { i32 1, [4 x i8] zeroinitializer }
33 define %struct @zeroinitializer-test2() {
34 %A = insertvalue %struct zeroinitializer, i8 1, 1, 2
36 ; CHECK: @zeroinitializer-test2
37 ; CHECK: ret %struct { i32 0, [4 x i8] c"\00\00\01\00" }
40 define [3 x %struct] @zeroinitializer-test3() {
41 %A = insertvalue [3 x %struct] zeroinitializer, i32 1, 1, 0
43 ; CHECK: @zeroinitializer-test3
44 ; CHECK: ret [3 x %struct] [%struct zeroinitializer, %struct { i32 1, [4 x i8] zeroinitializer }, %struct zeroinitializer]
47 define %struct @undef-test1() {
48 %A = insertvalue %struct undef, i32 1, 0
51 ; CHECK: ret %struct { i32 1, [4 x i8] undef }
54 define %struct @undef-test2() {
55 %A = insertvalue %struct undef, i8 0, 1, 2
58 ; CHECK: ret %struct { i32 undef, [4 x i8] [i8 undef, i8 undef, i8 0, i8 undef] }
61 define [3 x %struct] @undef-test3() {
62 %A = insertvalue [3 x %struct] undef, i32 0, 1, 0
65 ; CHECK: ret [3 x %struct] [%struct undef, %struct { i32 0, [4 x i8] undef }, %struct undef]
68 define i32 @test-float-Nan() {
69 %A = bitcast i32 2139171423 to float
70 %B = insertvalue [1 x float] undef, float %A, 0
71 %C = extractvalue [1 x float] %B, 0
72 %D = bitcast float %C to i32
74 ; CHECK: @test-float-Nan
75 ; CHECK: ret i32 2139171423
78 define i16 @test-half-Nan() {
79 %A = bitcast i16 32256 to half
80 %B = insertvalue [1 x half] undef, half %A, 0
81 %C = extractvalue [1 x half] %B, 0
82 %D = bitcast half %C to i16
84 ; CHECK: @test-half-Nan
85 ; CHECK: ret i16 32256