1 ; RUN: opt -mergefunc -S < %s | FileCheck %s
3 ; This test makes sure that the mergefunc pass, uses extract and insert value
4 ; to convert the struct result type; as struct types cannot be bitcast.
6 target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
8 %kv1 = type { i32*, i32* }
9 %kv2 = type { i8*, i8* }
16 %v1 = getelementptr %kv1, %kv1* %tmp, i32 0, i32 0
17 store i32* null, i32** %v1
18 %v2 = getelementptr %kv1, %kv1* %tmp, i32 0, i32 0
19 store i32* null, i32** %v2
21 %v3 = load %kv1, %kv1* %tmp
27 ; CHECK: %1 = tail call %kv1 @fn1()
28 ; CHECK: %2 = extractvalue %kv1 %1, 0
29 ; CHECK: %3 = bitcast i32* %2 to i8*
30 ; CHECK: %4 = insertvalue %kv2 undef, i8* %3, 0
32 %v1 = getelementptr %kv2, %kv2* %tmp, i32 0, i32 0
33 store i8* null, i8** %v1
34 %v2 = getelementptr %kv2, %kv2* %tmp, i32 0, i32 0
35 store i8* null, i8** %v2
38 %v3 = load %kv2, %kv2* %tmp