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 @vt1 = constant [1 x ptr] [ptr @vf1], !type !0
7 @vt2 = constant [1 x ptr] [ptr @vf2], !type !0
9 declare i32 @vf1(ptr %this, i32 %arg) readnone
11 define i32 @vf2(ptr %this, i32 %arg) readnone {
15 ; CHECK: define i32 @fn
16 define i32 @fn(ptr %obj) {
17 %vtable = load ptr, ptr %obj
18 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
19 call void @llvm.assume(i1 %p)
20 %fptr = load ptr, ptr %vtable
22 %result = call i32 %fptr(ptr %obj, i32 1)
25 declare i1 @llvm.type.test(ptr, metadata)
26 declare void @llvm.assume(i1)
28 !0 = !{i32 0, !"typeid"}