Exposed by -Warray-bounds:
In file included from
../../../../../../../llvm/offload/plugins-nextgen/common/src/GlobalHandler.cpp:252:
../../../../../../../llvm/llvm/include/llvm/ProfileData/InstrProfData.inc:109:1:
error: array index 4 is past the end of the array (that has type 'const
std::remove_const<const uint16_t>::type[4]' (aka 'const unsigned
short[4]')) [-Werror,-Warray-bounds]
109 | INSTR_PROF_DATA(const uint16_t, Int16ArrayTy,
NumValueSites[IPVK_Last+1], \
| ^ ~~~~~~~~~~~
../../../../../../../llvm/offload/plugins-nextgen/common/src/GlobalHandler.cpp:250:15:
note: expanded from macro 'INSTR_PROF_DATA'
250 | outs() << ProfData.Name << " "; \
| ^ ~~~~
../../../../../../../llvm/llvm/include/llvm/ProfileData/InstrProfData.inc:109:1:
note: array 'NumValueSites' declared here
109 | INSTR_PROF_DATA(const uint16_t, Int16ArrayTy,
NumValueSites[IPVK_Last+1], \
| ^
../../../../../../../llvm/offload/plugins-nextgen/common/include/GlobalHandler.h:62:3:
note: expanded from macro 'INSTR_PROF_DATA'
62 | std::remove_const<Type>::type Name;
Avoid accessing out-of-bound data, but skip printing array data for now.
As there is no simple way to do this without hardcoding the
NumValueSites field.
---------
Co-authored-by: Ethan Luis McDonough <ethanluismcdonough@gmail.com>
75 lines
2.6 KiB
C
75 lines
2.6 KiB
C
// RUN: %libomptarget-compile-generic -fprofile-instr-generate \
|
|
// RUN: -Xclang "-fprofile-instrument=clang"
|
|
// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic \
|
|
// RUN: --check-prefix="CLANG-PGO"
|
|
// RUN: %libomptarget-compile-generic -fprofile-generate \
|
|
// RUN: -Xclang "-fprofile-instrument=llvm"
|
|
// RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic \
|
|
// RUN: --check-prefix="LLVM-PGO"
|
|
|
|
// REQUIRES: gpu
|
|
// REQUIRES: pgo
|
|
|
|
#ifdef _OPENMP
|
|
#include <omp.h>
|
|
#endif
|
|
|
|
int test1(int a) { return a / 2; }
|
|
int test2(int a) { return a * 2; }
|
|
|
|
int main() {
|
|
int m = 2;
|
|
#pragma omp target
|
|
for (int i = 0; i < 10; i++) {
|
|
m = test1(m);
|
|
for (int j = 0; j < 2; j++) {
|
|
m = test2(m);
|
|
}
|
|
}
|
|
}
|
|
|
|
// CLANG-PGO: ======== Counters =========
|
|
// CLANG-PGO-NEXT: [ 0 11 20 ]
|
|
// CLANG-PGO-NEXT: [ 10 ]
|
|
// CLANG-PGO-NEXT: [ 20 ]
|
|
// CLANG-PGO-NEXT: ========== Data ===========
|
|
// CLANG-PGO-NEXT: { {{[0-9]*}} {{[0-9]*}}
|
|
// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// CLANG-PGO-SAME: {{[0-9]*}} {{.*}} {{[0-9]*}} }
|
|
// CLANG-PGO-NEXT: { {{[0-9]*}} {{[0-9]*}}
|
|
// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// CLANG-PGO-SAME: {{[0-9]*}} {{.*}} {{[0-9]*}} }
|
|
// CLANG-PGO-NEXT: { {{[0-9]*}} {{[0-9]*}}
|
|
// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// CLANG-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// CLANG-PGO-SAME: {{[0-9]*}} {{.*}} {{[0-9]*}} }
|
|
// CLANG-PGO-NEXT: ======== Functions ========
|
|
// CLANG-PGO-NEXT: pgo1.c:
|
|
// CLANG-PGO-SAME: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}
|
|
// CLANG-PGO-NEXT: test1
|
|
// CLANG-PGO-NEXT: test2
|
|
|
|
// LLVM-PGO: ======== Counters =========
|
|
// LLVM-PGO-NEXT: [ 20 10 2 1 ]
|
|
// LLVM-PGO-NEXT: [ 10 ]
|
|
// LLVM-PGO-NEXT: [ 20 ]
|
|
// LLVM-PGO-NEXT: ========== Data ===========
|
|
// LLVM-PGO-NEXT: { {{[0-9]*}} {{[0-9]*}}
|
|
// LLVM-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// LLVM-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// LLVM-PGO-SAME: {{[0-9]*}} {{.*}} {{[0-9]*}} }
|
|
// LLVM-PGO-NEXT: { {{[0-9]*}} {{[0-9]*}}
|
|
// LLVM-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// LLVM-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// LLVM-PGO-SAME: {{[0-9]*}} {{.*}} {{[0-9]*}} }
|
|
// LLVM-PGO-NEXT: { {{[0-9]*}} {{[0-9]*}}
|
|
// LLVM-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// LLVM-PGO-SAME: {{0x[0-9a-fA-F]*}} {{0x[0-9a-fA-F]*}}
|
|
// LLVM-PGO-SAME: {{[0-9]*}} {{.*}} {{[0-9]*}} }
|
|
// LLVM-PGO-NEXT: ======== Functions ========
|
|
// LLVM-PGO-NEXT: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}
|
|
// LLVM-PGO-NEXT: test1
|
|
// LLVM-PGO-NEXT: test2
|