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 @vf0], !type !0 7@vt2 = constant [1 x ptr] [ptr @vf0], !type !0, !type !1 8@vt3 = constant [1 x ptr] [ptr @vf1], !type !0, !type !1 9@vt4 = constant [1 x ptr] [ptr @vf1], !type !1 10 11define i1 @vf0(ptr %this) readnone { 12 ret i1 0 13} 14 15define i1 @vf1(ptr %this) readnone { 16 ret i1 1 17} 18 19; CHECK: define i1 @call 20define i1 @call(ptr %obj) { 21 %vtable = load ptr, ptr %obj 22 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1") 23 call void @llvm.assume(i1 %p) 24 %p2 = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1") 25 call void @llvm.assume(i1 %p2) 26 %fptr = load ptr, ptr %vtable 27 ; CHECK: [[RES1:%[^ ]*]] = icmp eq ptr %vtable, @vt3 28 %result = call i1 %fptr(ptr %obj) 29 ; CHECK: ret i1 [[RES1]] 30 ret i1 %result 31} 32 33declare i1 @llvm.type.test(ptr, metadata) 34declare void @llvm.assume(i1) 35 36!0 = !{i32 0, !"typeid1"} 37!1 = !{i32 0, !"typeid2"} 38