1 ; RUN: opt -S -passes=wholeprogramdevirt,verify -whole-program-visibility -pass-remarks=wholeprogramdevirt %s 2>&1 | FileCheck %s
3 target datalayout = "e-p:64:64"
4 target triple = "x86_64-unknown-linux-gnu"
6 ; CHECK: remark: <unknown>:0:0: single-impl: devirtualized a call to vf
7 ; CHECK: remark: <unknown>:0:0: devirtualized vf
8 ; CHECK-NOT: devirtualized
10 @vt1 = constant [1 x ptr] [ptr @vf], !type !0
11 @vt2 = constant [1 x ptr] [ptr @vf], !type !0
13 define void @vf(ptr %this) {
17 ; CHECK: define void @call
18 define void @call(ptr %obj) {
19 %vtable = load ptr, ptr %obj
20 %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 0, metadata !"typeid")
21 %fptr = extractvalue {ptr, i1} %pair, 0
22 %p = extractvalue {ptr, i1} %pair, 1
24 br i1 %p, label %cont, label %trap
27 ; CHECK: call void @vf(
28 call void %fptr(ptr %obj) [ "ptrauth"(i32 5, i64 120) ]
32 call void @llvm.trap()
36 declare {ptr, i1} @llvm.type.checked.load(ptr, i32, metadata)
37 declare void @llvm.trap()
39 !0 = !{i32 0, !"typeid"}