1; RUN: opt < %s -constprop -S | FileCheck %s 2 3%struct = type { i32, [4 x i8] } 4 5define %struct @test1() { 6 %A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i32 1, 0 7 ret %struct %A 8; CHECK-LABEL: @test1( 9; CHECK: ret %struct { i32 1, [4 x i8] c"foo\00" } 10} 11 12define %struct @test2() { 13 %A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i8 1, 1, 2 14 ret %struct %A 15; CHECK-LABEL: @test2( 16; CHECK: ret %struct { i32 2, [4 x i8] c"fo\01\00" } 17} 18 19define [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 21 ret [3 x %struct] %A 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" }] 24} 25 26define %struct @zeroinitializer-test1() { 27 %A = insertvalue %struct zeroinitializer, i32 1, 0 28 ret %struct %A 29; CHECK: @zeroinitializer-test1 30; CHECK: ret %struct { i32 1, [4 x i8] zeroinitializer } 31} 32 33define %struct @zeroinitializer-test2() { 34 %A = insertvalue %struct zeroinitializer, i8 1, 1, 2 35 ret %struct %A 36; CHECK: @zeroinitializer-test2 37; CHECK: ret %struct { i32 0, [4 x i8] c"\00\00\01\00" } 38} 39 40define [3 x %struct] @zeroinitializer-test3() { 41 %A = insertvalue [3 x %struct] zeroinitializer, i32 1, 1, 0 42 ret [3 x %struct] %A 43; CHECK: @zeroinitializer-test3 44; CHECK: ret [3 x %struct] [%struct zeroinitializer, %struct { i32 1, [4 x i8] zeroinitializer }, %struct zeroinitializer] 45} 46 47define %struct @undef-test1() { 48 %A = insertvalue %struct undef, i32 1, 0 49 ret %struct %A 50; CHECK: @undef-test1 51; CHECK: ret %struct { i32 1, [4 x i8] undef } 52} 53 54define %struct @undef-test2() { 55 %A = insertvalue %struct undef, i8 0, 1, 2 56 ret %struct %A 57; CHECK: @undef-test2 58; CHECK: ret %struct { i32 undef, [4 x i8] [i8 undef, i8 undef, i8 0, i8 undef] } 59} 60 61define [3 x %struct] @undef-test3() { 62 %A = insertvalue [3 x %struct] undef, i32 0, 1, 0 63 ret [3 x %struct] %A 64; CHECK: @undef-test3 65; CHECK: ret [3 x %struct] [%struct undef, %struct { i32 0, [4 x i8] undef }, %struct undef] 66} 67 68define 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 73 ret i32 %D 74; CHECK: @test-float-Nan 75; CHECK: ret i32 2139171423 76} 77