CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
45 lines
1.7 KiB
C++
45 lines
1.7 KiB
C++
// Tests for instrumentation of C++11 range-for
|
|
|
|
// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument=clang > %tgen
|
|
// RUN: FileCheck --input-file=%tgen -check-prefix=CHECK -check-prefix=PGOGEN %s
|
|
|
|
// RUN: llvm-profdata merge %S/Inputs/cxx-rangefor.proftext -o %t.profdata
|
|
// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument-use=clang -fprofile-instrument-use-path=%t.profdata > %tuse
|
|
// RUN: FileCheck --input-file=%tuse -check-prefix=CHECK -check-prefix=PGOUSE %s
|
|
|
|
// PGOGEN: @[[RFC:__profc__Z9range_forv]] = {{(private|internal)}} global [5 x i64] zeroinitializer
|
|
|
|
// CHECK-LABEL: define {{.*}}void @_Z9range_forv()
|
|
// PGOGEN: store {{.*}} @[[RFC]]
|
|
void range_for() {
|
|
int arr[] = {1, 2, 3, 4, 5};
|
|
int sum = 0;
|
|
// PGOGEN: store {{.*}} @[[RFC]], i32 0, i32 1
|
|
// PGOUSE: br {{.*}} !prof ![[RF1:[0-9]+]]
|
|
for (auto i : arr) {
|
|
// PGOGEN: store {{.*}} @[[RFC]], i32 0, i32 2
|
|
// PGOUSE: br {{.*}} !prof ![[RF2:[0-9]+]]
|
|
if (i == 3)
|
|
continue;
|
|
sum += i;
|
|
// PGOGEN: store {{.*}} @[[RFC]], i32 0, i32 3
|
|
// PGOUSE: br {{.*}} !prof ![[RF3:[0-9]+]]
|
|
if (sum >= 7)
|
|
break;
|
|
}
|
|
|
|
// PGOGEN: store {{.*}} @[[RFC]], i32 0, i32 4
|
|
// PGOUSE: br {{.*}} !prof ![[RF4:[0-9]+]]
|
|
if (sum) {}
|
|
}
|
|
|
|
// PGOUSE-DAG: ![[RF1]] = !{!"branch_weights", i32 5, i32 1}
|
|
// PGOUSE-DAG: ![[RF2]] = !{!"branch_weights", i32 2, i32 4}
|
|
// PGOUSE-DAG: ![[RF3]] = !{!"branch_weights", i32 2, i32 3}
|
|
// PGOUSE-DAG: ![[RF4]] = !{!"branch_weights", i32 2, i32 1}
|
|
|
|
int main(int argc, const char *argv[]) {
|
|
range_for();
|
|
return 0;
|
|
}
|