xref: /llvm-project/llvm/test/Instrumentation/InstrProfiling/coverage.ll (revision 16e74fd48988ac95551d0f64e1b36f78a82a89a2)
1; RUN: opt < %s -passes=instrprof -S | FileCheck %s
2; RUN: opt < %s -passes=instrprof -profile-correlate=binary -S | FileCheck %s --check-prefix=BINARY
3
4target triple = "aarch64-unknown-linux-gnu"
5
6@__profn_foo = private constant [3 x i8] c"foo"
7; CHECK: @__profc_foo = private global [1 x i8] c"\FF", section "__llvm_prf_cnts", comdat, align 1
8; CHECK: @__profd_foo = private global { i64, i64, i64, i64, ptr, ptr, i32, [3 x i16], i32 } { i64 {{.*}}, i64 {{.*}}, i64 sub (i64 ptrtoint (ptr @__profc_foo to i64)
9; BINARY: @__profd_foo = private global { i64, i64, i64, i64, ptr, ptr, i32, [3 x i16], i32 } { i64 {{.*}}, i64 {{.*}}, i64 ptrtoint (ptr @__profc_foo to i64),
10@__profn_bar = private constant [3 x i8] c"bar"
11; CHECK: @__profc_bar = private global [1 x i8] c"\FF", section "__llvm_prf_cnts", comdat, align 1
12; CHECK: @__profd_bar = private global { i64, i64, i64, i64, ptr, ptr, i32, [3 x i16], i32 } { i64 {{.*}}, i64 {{.*}}, i64 sub (i64 ptrtoint (ptr @__profc_bar to i64)
13; BINARY: @__profd_bar = private global { i64, i64, i64, i64, ptr, ptr, i32, [3 x i16], i32 } { i64 {{.*}}, i64 {{.*}}, i64 ptrtoint (ptr @__profc_bar to i64),
14
15; CHECK: @__llvm_prf_nm = {{.*}} section "__llvm_prf_names"
16; BINARY: @__llvm_prf_nm ={{.*}} section "__llvm_covnames"
17
18define void @_Z3foov() {
19  call void @llvm.instrprof.cover(ptr @__profn_foo, i64 12345678, i32 1, i32 0)
20  ; CHECK: store i8 0, ptr @__profc_foo, align 1
21  ret void
22}
23
24%class.A = type { ptr }
25define dso_local void @_Z3barv(ptr nocapture nonnull align 8 %0) unnamed_addr #0 align 2 {
26  call void @llvm.instrprof.cover(ptr @__profn_bar, i64 87654321, i32 1, i32 0)
27  ; CHECK: store i8 0, ptr @__profc_bar, align 1
28  ret void
29}
30
31declare void @llvm.instrprof.cover(ptr, i64, i32, i32)
32