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 define i32 @vf1(ptr %this) readnone {
13 define i32 @vf2(ptr %this) readnone {
17 ; CHECK: define i32 @call
18 define i32 @call(ptr %obj) personality ptr undef {
19 %vtable = load ptr, ptr %obj
20 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
21 call void @llvm.assume(i1 %p)
22 %fptr = load ptr, ptr %vtable
23 ; CHECK: br label %[[RET:[0-9A-Za-z]*]]
24 %result = invoke i32 %fptr(ptr %obj) to label %ret unwind label %unwind
27 %x = landingpad i32 cleanup
32 ; CHECK-NEXT: ret i32 123
36 declare i1 @llvm.type.test(ptr, metadata)
37 declare void @llvm.assume(i1)
39 !0 = !{i32 0, !"typeid"}