Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OpenMP][InstrProfiling] Fix a missing instr profiling counter
When emitting a function body there needs to be a instr profiling counter emitted. Otherwise instr profiling won't work for this function. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D98135
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: %clang_cc1 -verify -fopenmp -x c -emit-llvm %s -triple x86_64-unknown-linux -o - -femit-all-decls -disable-llvm-passes -fprofile-instrument=clang | FileCheck %s | ||
// expected-no-diagnostics | ||
|
||
void sub(double *restrict a, double *restrict b, int n) { | ||
int i; | ||
|
||
#pragma omp parallel for | ||
#pragma clang loop vectorize(disable) | ||
for (i = 0; i < n; i++) { | ||
a[i] = a[i] + b[i]; | ||
} | ||
} | ||
|
||
// CHECK-LABEL: @.omp_outlined.( | ||
// CHECK-NEXT: entry: | ||
// CHECK: call void @llvm.instrprof.increment( | ||
// CHECK: omp.precond.then: | ||
// CHECK-NEXT: call void @llvm.instrprof.increment( | ||
// CHECK: cond.true: | ||
// CEHCK-NEXT: call void @llvm.instrprof.increment( | ||
// CHECK: omp.inner.for.body: | ||
// CHECK-NEXT: call void @llvm.instrprof.increment( |