1; RUN: opt -S -passes=wholeprogramdevirt -whole-program-visibility %s | FileCheck %s 2 3target datalayout = "e-p:64:64" 4target triple = "x86_64-unknown-linux-gnu" 5 6@vt1 = constant [1 x ptr] [ptr @vf1], !type !0 7@vt2 = constant [1 x ptr] [ptr @vf2], !type !0 8 9define i32 @vf1(ptr %this, i32 %arg) readnone { 10 ret i32 %arg 11} 12 13define i32 @vf2(ptr %this, i32 %arg) readnone { 14 ret i32 %arg 15} 16 17; CHECK: define void @call 18define void @call(ptr %obj, i32 %arg) { 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: call i32 % 24 %result = call i32 %fptr(ptr %obj, i32 %arg) 25 ret void 26} 27 28declare i1 @llvm.type.test(ptr, metadata) 29declare void @llvm.assume(i1) 30 31!0 = !{i32 0, !"typeid"} 32