xref: /llvm-project/llvm/test/Transforms/PGOProfile/vtable_prof_unsupported.ll (revision 1351d17826e1efa3da3b29b6e345d44cb0ce3bc9)
1; RUN: opt < %s -passes=pgo-instr-gen -enable-vtable-value-profiling -S 2>&1 | FileCheck %s
2
3; Test that unsupported warning is emitted for non-ELF object files.
4target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
5target triple = "arm64-apple-macosx14.0.0"
6
7; CHECK: warning: {{.*}} VTable value profiling is presently not supported for non-ELF object formats
8
9@_ZTV4Base = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr @_ZN4Base4funcEi] }, !type !0, !type !1
10@_ZTV7Derived = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr @_ZN7Derived4funcEi] }, !type !0, !type !1, !type !2, !type !3
11
12@llvm.compiler.used = appending global [2 x ptr] [ptr @_ZTV4Base, ptr @_ZTV7Derived], section "llvm.metadata"
13
14define i32 @_Z4funci(i32 %a) {
15entry:
16  %call = call ptr @_Z10createTypev()
17  %vtable = load ptr, ptr %call
18  %0 = call i1 @llvm.public.type.test(ptr %vtable, metadata !"_ZTS7Derived")
19  call void @llvm.assume(i1 %0)
20  %1 = load ptr, ptr %vtable
21  %call1 = call i32 %1(ptr  %call, i32 %a)
22  ret i32 %call1
23}
24
25declare ptr @_Z10createTypev()
26declare i1 @llvm.public.type.test(ptr, metadata)
27declare void @llvm.assume(i1)
28declare i32 @_ZN4Base4funcEi(ptr, i32)
29declare i32 @_ZN7Derived4funcEi(ptr , i32)
30
31!0 = !{i64 16, !"_ZTS4Base"}
32!1 = !{i64 16, !"_ZTSM4BaseFiiE.virtual"}
33!2 = !{i64 16, !"_ZTS7Derived"}
34!3 = !{i64 16, !"_ZTSM7DerivedFiiE.virtual"}
35