aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorPetr Hosek <phosek@google.com>2021-01-15 01:14:37 -0800
committerPetr Hosek <phosek@google.com>2021-01-26 17:13:34 -0800
commitbb9eb198298099742c823dce11c5edacc9c48d4e (patch)
tree4d997db42ad6bcd384b6326bef0b2409cdb734b1 /clang/lib/CodeGen/CodeGenFunction.h
parentfc3192026b3156d39c223cc092297c39dd8013f3 (diff)
downloadllvm-bb9eb198298099742c823dce11c5edacc9c48d4e.zip
llvm-bb9eb198298099742c823dce11c5edacc9c48d4e.tar.gz
llvm-bb9eb198298099742c823dce11c5edacc9c48d4e.tar.bz2
Support for instrumenting only selected files or functions
This change implements support for applying profile instrumentation only to selected files or functions. The implementation uses the sanitizer special case list format to select which files and functions to instrument, and relies on the new noprofile IR attribute to exclude functions from instrumentation. Differential Revision: https://reviews.llvm.org/D94820
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 9d11466..8eb7adb 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -1442,7 +1442,8 @@ public:
/// Increment the profiler's counter for the given statement by \p StepV.
/// If \p StepV is null, the default increment is 1.
void incrementProfileCounter(const Stmt *S, llvm::Value *StepV = nullptr) {
- if (CGM.getCodeGenOpts().hasProfileClangInstr())
+ if (CGM.getCodeGenOpts().hasProfileClangInstr() &&
+ !CurFn->hasFnAttribute(llvm::Attribute::NoProfile))
PGO.emitCounterIncrement(Builder, S, StepV);
PGO.setCurrentStmt(S);
}