104 lines · c
1// RUN: %libomptarget-compile-generic -fprofile-generate2// RUN: env LLVM_PROFILE_FILE=%basename_t.llvm.profraw \3// RUN: %libomptarget-run-generic 2>&14// RUN: %profdata show --all-functions --counts \5// RUN: %basename_t.llvm.profraw | %fcheck-generic \6// RUN: --check-prefix="LLVM-HOST"7// RUN: %profdata show --all-functions --counts \8// RUN: %target_triple.%basename_t.llvm.profraw \9// RUN: | %fcheck-generic --check-prefix="LLVM-DEVICE"10 11// RUN: %libomptarget-compile-generic -fprofile-instr-generate12// RUN: env LLVM_PROFILE_FILE=%basename_t.clang.profraw \13// RUN: %libomptarget-run-generic 2>&114// RUN: %profdata show --all-functions --counts \15// RUN: %basename_t.clang.profraw | %fcheck-generic \16// RUN: --check-prefix="CLANG-HOST"17// RUN: %profdata show --all-functions --counts \18// RUN: %target_triple.%basename_t.clang.profraw | \19// RUN: %fcheck-generic --check-prefix="CLANG-DEV"20 21// RUN: %libomptarget-compile-generic -Xarch_host -fprofile-generate22// RUN: env LLVM_PROFILE_FILE=%basename_t.nogpu.profraw \23// RUN: %libomptarget-run-generic 2>&124// RUN: %profdata show --all-functions --counts \25// RUN: %basename_t.nogpu.profraw | %fcheck-generic \26// RUN: --check-prefix="LLVM-HOST"27// RUN: not test -e %target_triple.%basename_t.nogpu.profraw28 29// RUN: %libomptarget-compile-generic -Xarch_host -fprofile-generate \30// RUN: -Xarch_device -fprofile-instr-generate31// RUN: env LLVM_PROFILE_FILE=%basename_t.hidf.profraw \32// RUN: %libomptarget-run-generic 2>&133// RUN: %profdata show --all-functions --counts \34// RUN: %basename_t.hidf.profraw | %fcheck-generic \35// RUN: --check-prefix="LLVM-HOST"36// RUN: %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-generate42// RUN: env LLVM_PROFILE_FILE=%basename_t.hfdi.profraw \43// RUN: %libomptarget-run-generic 2>&144// RUN: %profdata show --all-functions --counts \45// RUN: %basename_t.hfdi.profraw | %fcheck-generic \46// RUN: --check-prefix="CLANG-HOST"47// RUN: %profdata show --all-functions --counts \48// RUN: %target_triple.%basename_t.hfdi.profraw \49// RUN: | %fcheck-generic --check-prefix="LLVM-DEVICE"50 51// REQUIRES: amdgpu52// REQUIRES: pgo53 54int main() {55 int host_var = 0;56 for (int i = 0; i < 20; i++) {57 host_var += i;58 }59 60 int device_var = 1;61#pragma omp target62 {63 for (int i = 0; i < 10; i++) {64 device_var *= i;65 }66 }67}68 69// LLVM-HOST-LABEL: main:70// LLVM-HOST: Hash: {{0[xX][0-9a-fA-F]+}}71// LLVM-HOST: Counters: 372// LLVM-HOST: Block counts: [20, 1, 0]73 74// LLVM-HOST-LABEL: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}:75// LLVM-HOST: Hash: {{0[xX][0-9a-fA-F]+}}76// LLVM-HOST: Counters: 277// LLVM-HOST: Block counts: [0, 0]78// LLVM-HOST: Instrumentation level: IR79 80// LLVM-DEVICE-LABEL: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}:81// LLVM-DEVICE: Hash: {{0[xX][0-9a-fA-F]+}}82// LLVM-DEVICE: Counters: 383// LLVM-DEVICE: Block counts: [10, {{.*}}, 1]84// LLVM-DEVICE: Instrumentation level: IR85 86// CLANG-HOST-LABEL: main:87// CLANG-HOST: Hash: {{0[xX][0-9a-fA-F]+}}88// CLANG-HOST: Counters: 289// CLANG-HOST: Function count: 190// CLANG-HOST: Block counts: [20]91 92// CLANG-HOST-LABEL: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}:93// CLANG-HOST: Hash: {{0[xX][0-9a-fA-F]+}}94// CLANG-HOST: Counters: 295// CLANG-HOST: Function count: 096// CLANG-HOST: Block counts: [0]97// CLANG-HOST: Instrumentation level: Front-end98 99// CLANG-DEV-LABEL: __omp_offloading_{{[_0-9a-zA-Z]*}}_main_{{[_0-9a-zA-Z]*}}:100// CLANG-DEV: Hash: {{0[xX][0-9a-fA-F]+}}101// CLANG-DEV: Counters: 2102// CLANG-DEV: Block counts: [10]103// CLANG-DEV: Instrumentation level: Front-end104