From fdf22598862a072fe6136bc0484b5747e68da20d Mon Sep 17 00:00:00 2001 From: Mircea Trofin Date: Mon, 7 Nov 2022 11:10:58 -0800 Subject: [PATCH] [NFC] Comment in MLInlineAdvisor as to why use std::map for FPICache --- llvm/include/llvm/Analysis/MLInlineAdvisor.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/llvm/include/llvm/Analysis/MLInlineAdvisor.h index 3db948d..7535464 100644 --- a/llvm/include/llvm/Analysis/MLInlineAdvisor.h +++ b/llvm/include/llvm/Analysis/MLInlineAdvisor.h @@ -69,6 +69,9 @@ private: 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 FPICache; LazyCallGraph &CG; -- 2.7.4