[llvm] [ctx_prof] CtxProfAnalysis: populate module data (PR #102930)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 09:58:48 PDT 2024
================
@@ -35,6 +51,20 @@ class PGOContextualProfile {
return *Profiles;
}
+ bool isFunctionKnown(const Function &F) const {
+ return getDefinedFunctionGUID(F) != 0;
+ }
+
+ uint32_t allocateNextCounterIndex(const Function &F) {
+ assert(isFunctionKnown(F));
+ return FuncInfo.find(getDefinedFunctionGUID(F))->second.NextCounterIndex++;
----------------
snehasish wrote:
Is this performing the lookup 2x on an assert build? If so maybe rewrite this as
```
auto& [found, iter] = FuncInfo.find(....);
(void) found;
assert(found && "function not found");
```
https://github.com/llvm/llvm-project/pull/102930
More information about the llvm-commits
mailing list