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