summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2022-08-04 13:04:59 -0400
committerNico Weber <thakis@chromium.org>2022-08-04 13:04:59 -0400
commit0eb7d86f5873ce897894339a3cc5bc69ca507bee (patch)
treeb3b7912ec6261bdff6ea6186e0b4182abd57b4aa /clang/lib/CodeGen/CodeGenModule.cpp
parent07aaa35f74d845a20d48e644671dce150ebf7748 (diff)
Revert "[InstrProf] Add new format for -fprofile-list="
This reverts commit b692312ca432d9a379f67a8d83177a6f1722baaa. Breaks tests on Windows, see https://reviews.llvm.org/D130808#3699952
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 8771f9e7f56d..537cb78611b4 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2895,44 +2895,46 @@ bool CodeGenModule::imbueXRayAttrs(llvm::Function *Fn, SourceLocation Loc,
return true;
}
-ProfileList::ExclusionType
-CodeGenModule::isFunctionBlockedByProfileList(llvm::Function *Fn,
- SourceLocation Loc) const {
+bool CodeGenModule::isFunctionBlockedByProfileList(llvm::Function *Fn,
+ SourceLocation Loc) const {
const auto &ProfileList = getContext().getProfileList();
// If the profile list is empty, then instrument everything.
if (ProfileList.isEmpty())
- return ProfileList::Allow;
+ return false;
CodeGenOptions::ProfileInstrKind Kind = getCodeGenOpts().getProfileInstr();
// First, check the function name.
- if (auto V = ProfileList.isFunctionExcluded(Fn->getName(), Kind))
+ Optional<bool> V = ProfileList.isFunctionExcluded(Fn->getName(), Kind);
+ if (V)
return *V;
// Next, check the source location.
- if (Loc.isValid())
- if (auto V = ProfileList.isLocationExcluded(Loc, Kind))
+ if (Loc.isValid()) {
+ Optional<bool> V = ProfileList.isLocationExcluded(Loc, Kind);
+ if (V)
return *V;
+ }
// If location is unknown, this may be a compiler-generated function. Assume
// it's located in the main file.
auto &SM = Context.getSourceManager();
- if (const auto *MainFile = SM.getFileEntryForID(SM.getMainFileID()))
- if (auto V = ProfileList.isFileExcluded(MainFile->getName(), Kind))
+ if (const auto *MainFile = SM.getFileEntryForID(SM.getMainFileID())) {
+ Optional<bool> V = ProfileList.isFileExcluded(MainFile->getName(), Kind);
+ if (V)
return *V;
- return ProfileList.getDefault(Kind);
+ }
+ return ProfileList.getDefault();
}
-ProfileList::ExclusionType
-CodeGenModule::isFunctionBlockedFromProfileInstr(llvm::Function *Fn,
- SourceLocation Loc) const {
- auto V = isFunctionBlockedByProfileList(Fn, Loc);
- if (V != ProfileList::Allow)
- return V;
+bool CodeGenModule::isFunctionBlockedFromProfileInstr(
+ llvm::Function *Fn, SourceLocation Loc) const {
+ if (isFunctionBlockedByProfileList(Fn, Loc))
+ return true;
auto NumGroups = getCodeGenOpts().ProfileTotalFunctionGroups;
if (NumGroups > 1) {
auto Group = llvm::crc32(arrayRefFromStringRef(Fn->getName())) % NumGroups;
if (Group != getCodeGenOpts().ProfileSelectedFunctionGroup)
- return ProfileList::Skip;
+ return true;
}
- return ProfileList::Allow;
+ return false;
}
bool CodeGenModule::MustBeEmitted(const ValueDecl *Global) {