1; RUN: opt -S -wholeprogramdevirt -pass-remarks=wholeprogramdevirt %s 2>&1 | FileCheck %s
2
3; CHECK-NOT: devirtualized call
4
5target datalayout = "e-p:64:64"
6target triple = "x86_64-unknown-linux-gnu"
7
8@vt = global [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
9
10define void @vf(i8* %this) {
11  ret void
12}
13
14; CHECK: define void @call
15define void @call(i8* %obj) {
16  %vtableptr = bitcast i8* %obj to [1 x i8*]**
17  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
18  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
19  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
20  call void @llvm.assume(i1 %p)
21  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
22  %fptr = load i8*, i8** %fptrptr
23  %fptr_casted = bitcast i8* %fptr to void (i8*)*
24  ; CHECK: call void %
25  call void %fptr_casted(i8* %obj)
26  ret void
27}
28
29declare i1 @llvm.type.test(i8*, metadata)
30declare void @llvm.assume(i1)
31
32!0 = !{i32 0, !"typeid"}
33