81 lines · c
1// RUN: %libomptarget-compile-generic -fcreate-profile \2// RUN: -Xarch_device -fprofile-generate3// RUN: env LLVM_PROFILE_FILE=%basename_t.llvm.profraw \4// RUN: %libomptarget-run-generic 2>&15// RUN: %profdata show --all-functions --counts \6// RUN: %target_triple.%basename_t.llvm.profraw | \7// RUN: %fcheck-generic --check-prefix="LLVM-PGO"8 9// RUN: %libomptarget-compile-generic -fcreate-profile \10// RUN: -Xarch_device -fprofile-instr-generate11// RUN: env LLVM_PROFILE_FILE=%basename_t.clang.profraw \12// RUN: %libomptarget-run-generic 2>&113// RUN: %profdata show --all-functions --counts \14// RUN: %target_triple.%basename_t.clang.profraw | \15// RUN: %fcheck-generic --check-prefix="CLANG-PGO"16 17// REQUIRES: amdgpu18// REQUIRES: pgo19 20int test1(int a) { return a / 2; }21int test2(int a) { return a * 2; }22 23int main() {24 int m = 2;25#pragma omp target26 {27 for (int i = 0; i < 10; i++) {28 m = test1(m);29 for (int j = 0; j < 2; j++) {30 m = test2(m);31 }32 }33 }34}35 36// LLVM-PGO-LABEL: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}:37// LLVM-PGO: Hash: {{0[xX][0-9a-fA-F]+}}38// LLVM-PGO: Counters: 439// LLVM-PGO: Block counts: [20, 10, {{.*}}, 1]40 41// LLVM-PGO-LABEL: test1:42// LLVM-PGO: Hash: {{0[xX][0-9a-fA-F]+}}43// LLVM-PGO: Counters: 144// LLVM-PGO: Block counts: [10]45 46// LLVM-PGO-LABEL: test2:47// LLVM-PGO: Hash: {{0[xX][0-9a-fA-F]+}}48// LLVM-PGO: Counters: 149// LLVM-PGO: Block counts: [20]50 51// LLVM-PGO-LABEL: Instrumentation level:52// LLVM-PGO-SAME: IR53// LLVM-PGO-SAME: entry_first = 054// LLVM-PGO-LABEL: Functions shown:55// LLVM-PGO-SAME: 356// LLVM-PGO-LABEL: Maximum function count:57// LLVM-PGO-SAME: 2058 59// CLANG-PGO-LABEL: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}:60// CLANG-PGO: Hash: {{0[xX][0-9a-fA-F]+}}61// CLANG-PGO: Block counts: [10, 20]62 63// CLANG-PGO-LABEL: test1:64// CLANG-PGO: Hash: {{0[xX][0-9a-fA-F]+}}65// CLANG-PGO: Counters: 166// CLANG-PGO: Function count: 1067// CLANG-PGO: Block counts: []68 69// CLANG-PGO-LABEL: test2:70// CLANG-PGO: Hash: {{0[xX][0-9a-fA-F]+}}71// CLANG-PGO: Counters: 172// CLANG-PGO: Function count: 2073// CLANG-PGO: Block counts: []74 75// CLANG-PGO-LABEL: Instrumentation level:76// CLANG-PGO-SAME: Front-end77// CLANG-PGO-LABEL: Functions shown:78// CLANG-PGO-SAME: 379// CLANG-PGO-LABEL: Maximum internal block count:80// CLANG-PGO-SAME: 2081