[llvm] fdf2259 - [NFC] Comment in MLInlineAdvisor as to why use std::map for FPICache
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 11:11:50 PST 2022
Author: Mircea Trofin
Date: 2022-11-07T11:10:58-08:00
New Revision: fdf22598862a072fe6136bc0484b5747e68da20d
URL: https://github.com/llvm/llvm-project/commit/fdf22598862a072fe6136bc0484b5747e68da20d
DIFF: https://github.com/llvm/llvm-project/commit/fdf22598862a072fe6136bc0484b5747e68da20d.diff
LOG: [NFC] Comment in MLInlineAdvisor as to why use std::map for FPICache
Added:
Modified:
llvm/include/llvm/Analysis/MLInlineAdvisor.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/llvm/include/llvm/Analysis/MLInlineAdvisor.h
index 3db948d365c7..7535464e0710 100644
--- a/llvm/include/llvm/Analysis/MLInlineAdvisor.h
+++ b/llvm/include/llvm/Analysis/MLInlineAdvisor.h
@@ -69,6 +69,9 @@ class MLInlineAdvisor : public InlineAdvisor {
getSkipAdviceIfUnreachableCallsite(CallBase &CB);
void print(raw_ostream &OS) const override;
+ // Using std::map to benefit from its iterator / reference non-invalidating
+ // semantics, which make it easy to use `getCachedFPI` results from multiple
+ // calls without needing to copy to avoid invalidation effects.
mutable std::map<const Function *, FunctionPropertiesInfo> FPICache;
LazyCallGraph &CG;
More information about the llvm-commits
mailing list