aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorEllis Hoag <ellis.sparky.hoag@gmail.com>2022-07-29 14:49:44 -0700
committerEllis Hoag <ellis.sparky.hoag@gmail.com>2022-08-04 08:49:43 -0700
commitb692312ca432d9a379f67a8d83177a6f1722baaa (patch)
treebc5a3169a2cd3969faa9bcbc1da314b6854070d2 /clang/lib/CodeGen/CodeGenFunction.cpp
parentbcf6ffb87ec67ba41daeaab905b2c57a50568aa0 (diff)
downloadllvm-b692312ca432d9a379f67a8d83177a6f1722baaa.zip
llvm-b692312ca432d9a379f67a8d83177a6f1722baaa.tar.gz
llvm-b692312ca432d9a379f67a8d83177a6f1722baaa.tar.bz2
[InstrProf] Add new format for -fprofile-list=
In D130807 we added the `skipprofile` attribute. This commit changes the format so we can either `forbid` or `skip` profiling functions by adding the `noprofile` or `skipprofile` attributes, respectively. The behavior of the original format remains unchanged. Also, add the `skipprofile` attribute when using `-fprofile-function-groups`. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D130808
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index d2f2515..7997a07 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -851,9 +851,18 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
}
}
- if (CGM.getCodeGenOpts().getProfileInstr() != CodeGenOptions::ProfileNone)
- if (CGM.isFunctionBlockedFromProfileInstr(Fn, Loc))
+ if (CGM.getCodeGenOpts().getProfileInstr() != CodeGenOptions::ProfileNone) {
+ switch (CGM.isFunctionBlockedFromProfileInstr(Fn, Loc)) {
+ case ProfileList::Skip:
+ Fn->addFnAttr(llvm::Attribute::SkipProfile);
+ break;
+ case ProfileList::Forbid:
Fn->addFnAttr(llvm::Attribute::NoProfile);
+ break;
+ case ProfileList::Allow:
+ break;
+ }
+ }
unsigned Count, Offset;
if (const auto *Attr =