1 ; RUN: opt -S -wholeprogramdevirt -wholeprogramdevirt-summary-action=import -wholeprogramdevirt-read-summary=%S/Inputs/import-vcp.yaml < %s | FileCheck %s
3 target datalayout = "e-p:64:64"
4 target triple = "x86_64-unknown-linux-gnu"
6 define i32 @call1(i1 %a, i8* %obj) {
7 %vtableptr = bitcast i8* %obj to [3 x i8*]**
8 %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
9 br i1 %a, label %bb1, label %bb2
12 ; CHECK: {{.*}} = bitcast {{.*}} to i8*
13 %vtablei8_1 = bitcast [3 x i8*]* %vtable to i8*
14 %p1 = call i1 @llvm.type.test(i8* %vtablei8_1, metadata !"typeid1")
15 call void @llvm.assume(i1 %p1)
16 %fptrptr1 = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 0
17 %fptr1 = load i8*, i8** %fptrptr1
18 %fptr1_casted = bitcast i8* %fptr1 to i32 (i8*, i32)*
19 ; CHECK: {{.*}} = bitcast {{.*}} to i8*
20 %result1 = call i32 %fptr1_casted(i8* %obj, i32 1)
25 %vtablei8_2 = bitcast [3 x i8*]* %vtable to i8*
26 %p = call i1 @llvm.type.test(i8* %vtablei8_2, metadata !"typeid1")
27 call void @llvm.assume(i1 %p)
28 %fptrptr2 = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 0
29 %fptr2 = load i8*, i8** %fptrptr2
30 %fptr2_casted = bitcast i8* %fptr2 to i32 (i8*, i32)*
31 ; CHECK: {{.*}} = bitcast {{.*}} to i8*
32 %result2 = call i32 %fptr2_casted(i8* %obj, i32 1)
36 declare void @llvm.assume(i1)
37 declare i1 @llvm.type.test(i8*, metadata)