1 ; -stats requires asserts
4 ; RUN: opt -S -passes=wholeprogramdevirt -whole-program-visibility -pass-remarks=wholeprogramdevirt -stats %s 2>&1 | FileCheck %s
6 target datalayout = "e-p:64:64"
7 target triple = "x86_64-unknown-linux-gnu"
9 ; CHECK: remark: {{.*}} uniform-ret-val: devirtualized a call to vf1
10 ; CHECK: remark: {{.*}} devirtualized vf1
11 ; CHECK: remark: {{.*}} devirtualized vf2
13 @vt1 = constant [1 x ptr] [ptr @vf1], !type !0
14 @vt2 = constant [1 x ptr] [ptr @vf2], !type !0
16 define i32 @vf1(ptr %this) readnone {
20 define i32 @vf2(ptr %this) readnone {
24 ; CHECK: define i32 @call
25 define i32 @call(ptr %obj) {
26 %vtable = load ptr, ptr %obj
27 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
28 call void @llvm.assume(i1 %p)
29 %fptr = load ptr, ptr %vtable
30 %result = call i32 %fptr(ptr %obj)
31 ; CHECK-NOT: call i32 %
36 declare i1 @llvm.type.test(ptr, metadata)
37 declare void @llvm.assume(i1)
39 !0 = !{i32 0, !"typeid"}
41 ; CHECK: 2 wholeprogramdevirt - Number of whole program devirtualization targets
42 ; CHECK: 1 wholeprogramdevirt - Number of uniform return value optimizations