diff options
author | Ellis Hoag <ellis.sparky.hoag@gmail.com> | 2022-07-29 16:23:46 -0700 |
---|---|---|
committer | Ellis Hoag <ellis.sparky.hoag@gmail.com> | 2022-08-04 08:45:27 -0700 |
commit | 12e78ff88105f2dc6cb1449d6fcd5d8f69e0512f (patch) | |
tree | 652e87fc7305b7d2d10eb24ca56bffe00af4fb11 /clang/lib/CodeGen/CodeGenFunction.h | |
parent | ec7f4a7c5d9794c9fdf4f894873e7edbbfddf3e2 (diff) | |
download | llvm-12e78ff88105f2dc6cb1449d6fcd5d8f69e0512f.zip llvm-12e78ff88105f2dc6cb1449d6fcd5d8f69e0512f.tar.gz llvm-12e78ff88105f2dc6cb1449d6fcd5d8f69e0512f.tar.bz2 |
[InstrProf] Add the skipprofile attribute
As discussed in [0], this diff adds the `skipprofile` attribute to
prevent the function from being profiled while allowing profiled
functions to be inlined into it. The `noprofile` attribute remains
unchanged.
The `noprofile` attribute is used for functions where it is
dangerous to add instrumentation to while the `skipprofile` attribute is
used to reduce code size or performance overhead.
[0] https://discourse.llvm.org/t/why-does-the-noprofile-attribute-restrict-inlining/64108
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D130807
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index b61a2a6..30cf162 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -1522,7 +1522,8 @@ public: /// If \p StepV is null, the default increment is 1. void incrementProfileCounter(const Stmt *S, llvm::Value *StepV = nullptr) { if (CGM.getCodeGenOpts().hasProfileClangInstr() && - !CurFn->hasFnAttribute(llvm::Attribute::NoProfile)) + !CurFn->hasFnAttribute(llvm::Attribute::NoProfile) && + !CurFn->hasFnAttribute(llvm::Attribute::SkipProfile)) PGO.emitCounterIncrement(Builder, S, StepV); PGO.setCurrentStmt(S); } |