Skip to content

Commit 0dd32c3

Browse files
Manually set Version instead of changing instprof macros
1 parent 298dafc commit 0dd32c3

File tree

6 files changed

+31
-4
lines changed

6 files changed

+31
-4
lines changed

compiler-rt/lib/profile/InstrProfilingWriter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ COMPILER_RT_VISIBILITY int lprofWriteDataImpl(
308308
#define INSTR_PROF_RAW_HEADER(Type, Name, Init) Header.Name = Init;
309309
#include "profile/InstrProfData.inc"
310310
}
311+
Header.Version = Version;
311312

312313
/* On WIN64, label differences are truncated 32-bit values. Truncate
313314
* CountersDelta to match. */

llvm/include/llvm/ProfileData/InstrProfData.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ INSTR_PROF_VALUE_NODE(PtrToNodeT, llvm::PointerType::getUnqual(Ctx), Next, \
152152
#define INSTR_PROF_DATA_DEFINED
153153
#endif
154154
INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
155-
INSTR_PROF_RAW_HEADER(uint64_t, Version, Version)
155+
INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
156156
INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
157157
INSTR_PROF_RAW_HEADER(uint64_t, NumData, NumData)
158158
INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesBeforeCounters, PaddingBytesBeforeCounters)

llvm/test/tools/llvm-profdata/binary-ids-padding.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Header
22
//
33
// INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
4-
// INSTR_PROF_RAW_HEADER(uint64_t, Version, Version)
4+
// INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
55
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
66
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
77
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)

llvm/test/tools/llvm-profdata/malformed-not-space-for-another-header.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Header
22
//
33
// INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
4-
// INSTR_PROF_RAW_HEADER(uint64_t, Version, Version)
4+
// INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
55
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
66
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
77
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)

llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Header
22
//
33
// INSTR_PROF_RAW_HEADER(uint64_t, Magic, __llvm_profile_get_magic())
4-
// INSTR_PROF_RAW_HEADER(uint64_t, Version, Version)
4+
// INSTR_PROF_RAW_HEADER(uint64_t, Version, __llvm_profile_get_version())
55
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
66
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
77
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)

offload/test/offloading/gpupgo/pgo2.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,28 @@
2626
// RUN: --check-prefix="LLVM-HOST"
2727
// RUN: not test -e %target_triple.%basename_t.nogpu.profraw
2828

29+
// RUN: %libomptarget-compile-generic -Xarch_host -fprofile-generate \
30+
// RUN: -Xarch_device -fprofile-instr-generate
31+
// RUN: env LLVM_PROFILE_FILE=%basename_t.hidf.profraw \
32+
// RUN: %libomptarget-run-generic 2>&1
33+
// RUN: llvm-profdata show --all-functions --counts \
34+
// RUN: %basename_t.hidf.profraw | %fcheck-generic \
35+
// RUN: --check-prefix="LLVM-HOST"
36+
// RUN: llvm-profdata show --all-functions --counts \
37+
// RUN: %target_triple.%basename_t.hidf.profraw \
38+
// RUN: | %fcheck-generic --check-prefix="CLANG-DEV"
39+
40+
// RUN: %libomptarget-compile-generic -Xarch_device -fprofile-generate \
41+
// RUN: -Xarch_host -fprofile-instr-generate
42+
// RUN: env LLVM_PROFILE_FILE=%basename_t.hfdi.profraw \
43+
// RUN: %libomptarget-run-generic 2>&1
44+
// RUN: llvm-profdata show --all-functions --counts \
45+
// RUN: %basename_t.hfdi.profraw | %fcheck-generic \
46+
// RUN: --check-prefix="CLANG-HOST"
47+
// RUN: llvm-profdata show --all-functions --counts \
48+
// RUN: %target_triple.%basename_t.hfdi.profraw \
49+
// RUN: | %fcheck-generic --check-prefix="LLVM-DEVICE"
50+
2951
// REQUIRES: gpu
3052
// REQUIRES: pgo
3153

@@ -51,11 +73,13 @@ int main() {
5173
// LLVM-HOST: Hash: {{0[xX][0-9a-fA-F]+}}
5274
// LLVM-HOST: Counters: 2
5375
// LLVM-HOST: Block counts: [0, 0]
76+
// LLVM-HOST: Instrumentation level: IR
5477

5578
// LLVM-DEVICE-LABEL: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}:
5679
// LLVM-DEVICE: Hash: {{0[xX][0-9a-fA-F]+}}
5780
// LLVM-DEVICE: Counters: 3
5881
// LLVM-DEVICE: Block counts: [10, 2, 1]
82+
// LLVM-DEVICE: Instrumentation level: IR
5983

6084
// CLANG-HOST-LABEL: main:
6185
// CLANG-HOST: Hash: {{0[xX][0-9a-fA-F]+}}
@@ -68,9 +92,11 @@ int main() {
6892
// CLANG-HOST: Counters: 2
6993
// CLANG-HOST: Function count: 0
7094
// CLANG-HOST: Block counts: [0]
95+
// CLANG-HOST: Instrumentation level: Front-end
7196

7297
// CLANG-DEV-LABEL: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}:
7398
// CLANG-DEV: Hash: {{0[xX][0-9a-fA-F]+}}
7499
// CLANG-DEV: Counters: 2
75100
// CLANG-DEV: Function count: 0
76101
// CLANG-DEV: Block counts: [11]
102+
// CLANG-DEV: Instrumentation level: Front-end

0 commit comments

Comments
 (0)