1 ; RUN: opt -S -wholeprogramdevirt -whole-program-visibility %s | FileCheck %s
3 target datalayout = "e-p:64:64"
4 target triple = "x86_64-unknown-linux-gnu"
6 @vt1 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
7 @vt2 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
9 define void @vf(i8* %this) {
13 ; CHECK: define void @call
14 define void @call(i8* %obj) {
15 %vtableptr = bitcast i8* %obj to [1 x i8*]**
16 %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
17 %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
18 %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
19 call void @llvm.assume(i1 %p)
20 %p2 = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
21 call void @llvm.assume(i1 %p2)
22 %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
23 %fptr = load i8*, i8** %fptrptr
24 %fptr_casted = bitcast i8* %fptr to void (i8*)*
25 ; CHECK: call void @vf(
26 call void %fptr_casted(i8* %obj)
30 declare i1 @llvm.type.test(i8*, metadata)
31 declare void @llvm.assume(i1)
33 !0 = !{i32 0, !"typeid"}