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
8 @vt3 = constant [1 x ptr] [ptr @vf3], !type !1
9 @vt4 = constant [1 x ptr] [ptr @vf4], !type !1
11 define i64 @vf1(ptr %this, i128 %arg) readnone {
12 %argtrunc = trunc i128 %arg to i64
16 define i64 @vf2(ptr %this, i128 %arg) readnone {
17 %argtrunc = trunc i128 %arg to i64
21 define i128 @vf3(ptr %this, i64 %arg) readnone {
22 %argzext = zext i64 %arg to i128
26 define i128 @vf4(ptr %this, i64 %arg) readnone {
27 %argzext = zext i64 %arg to i128
31 ; CHECK: define i64 @call1
32 define i64 @call1(ptr %obj) {
33 %vtable = load ptr, ptr %obj
34 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
35 call void @llvm.assume(i1 %p)
36 %fptr = load ptr, ptr %vtable
38 %result = call i64 %fptr(ptr %obj, i128 1)
42 ; CHECK: define i128 @call2
43 define i128 @call2(ptr %obj) {
44 %vtable = load ptr, ptr %obj
45 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid2")
46 call void @llvm.assume(i1 %p)
47 %fptr = load ptr, ptr %vtable
49 %result = call i128 %fptr(ptr %obj, i64 1)
53 declare i1 @llvm.type.test(ptr, metadata)
54 declare void @llvm.assume(i1)
56 !0 = !{i32 0, !"typeid1"}
57 !1 = !{i32 0, !"typeid2"}