1 ; RUN: opt < %s -constprop -S | FileCheck %s
3 %struct = type { i32, [4 x i8] }
4 %array = type [3 x %struct]
6 define %struct @test1() {
7 %A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i32 1, 0
10 ; CHECK: ret %struct { i32 1, [4 x i8] c"foo\00" }
13 define %struct @test2() {
14 %A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i8 1, 1, 2
17 ; CHECK: ret %struct { i32 2, [4 x i8] c"fo\01\00" }
20 define %array @test3() {
21 %A = insertvalue %array [ %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
24 ; CHECK:ret %array [%struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 -1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" }]
27 define %struct @zeroinitializer-test1() {
28 %A = insertvalue %struct zeroinitializer, i32 1, 0
30 ; CHECK: @zeroinitializer-test1
31 ; CHECK: ret %struct { i32 1, [4 x i8] zeroinitializer }
34 define %struct @zeroinitializer-test2() {
35 %A = insertvalue %struct zeroinitializer, i8 1, 1, 2
37 ; CHECK: @zeroinitializer-test2
38 ; CHECK: ret %struct { i32 0, [4 x i8] c"\00\00\01\00" }
41 define %array @zeroinitializer-test3() {
42 %A = insertvalue %array zeroinitializer, i32 1, 1, 0
44 ; CHECK: @zeroinitializer-test3
45 ; CHECK: ret %array [%struct zeroinitializer, %struct { i32 1, [4 x i8] zeroinitializer }, %struct zeroinitializer]
48 define %struct @undef-test1() {
49 %A = insertvalue %struct undef, i32 1, 0
52 ; CHECK: ret %struct { i32 1, [4 x i8] undef }
55 define %struct @undef-test2() {
56 %A = insertvalue %struct undef, i8 0, 1, 2
59 ; CHECK: ret %struct { i32 undef, [4 x i8] [i8 undef, i8 undef, i8 0, i8 undef] }
62 define %array @undef-test3() {
63 %A = insertvalue %array undef, i32 0, 1, 0
66 ; CHECK: ret %array [%struct undef, %struct { i32 0, [4 x i8] undef }, %struct undef]