1 ; RUN: opt -S -passes=wholeprogramdevirt -whole-program-visibility %s | FileCheck %s
3 target datalayout = "e-p:64:64"
4 target triple = "x86_64-unknown-linux-gnu"
6 %vtTy = type { [2 x ptr], [2 x ptr] }
8 @vt = constant %vtTy { [2 x ptr] [ptr null, ptr @vf1], [2 x ptr] [ptr null, ptr @vf2] }, !type !0, !type !1
10 define void @vf1(ptr %this) {
14 define void @vf2(ptr %this) {
18 ; CHECK: define void @call1
19 define void @call1(ptr %obj) {
20 %vtable = load ptr, ptr %obj
21 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
22 call void @llvm.assume(i1 %p)
23 %fptr = load ptr, ptr %vtable
24 ; CHECK: call void @vf1(
25 call void %fptr(ptr %obj)
29 ; CHECK: define void @call2
30 define void @call2(ptr %obj) {
31 %vtable = load ptr, ptr %obj
32 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid2")
33 call void @llvm.assume(i1 %p)
34 %fptr = load ptr, ptr %vtable
35 ; CHECK: call void @vf2(
36 call void %fptr(ptr %obj)
40 declare i1 @llvm.type.test(ptr, metadata)
41 declare void @llvm.assume(i1)
43 !0 = !{i32 8, !"typeid1"}
44 !1 = !{i32 24, !"typeid2"}