[llvm] [InlineCost] Cache collectEphemeralValues() to save compile time (PR #130210)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 19 09:19:57 PDT 2025
================
@@ -273,14 +274,14 @@ int getCallsiteCost(const TargetTransformInfo &TTI, const CallBase &Call,
///
/// Also note that calling this function *dynamically* computes the cost of
/// inlining the callsite. It is an expensive, heavyweight call.
-InlineCost
-getInlineCost(CallBase &Call, const InlineParams &Params,
- TargetTransformInfo &CalleeTTI,
- function_ref<AssumptionCache &(Function &)> GetAssumptionCache,
- function_ref<const TargetLibraryInfo &(Function &)> GetTLI,
- function_ref<BlockFrequencyInfo &(Function &)> GetBFI = nullptr,
- ProfileSummaryInfo *PSI = nullptr,
- OptimizationRemarkEmitter *ORE = nullptr);
+InlineCost getInlineCost(
+ CallBase &Call, const InlineParams &Params, TargetTransformInfo &CalleeTTI,
+ function_ref<AssumptionCache &(Function &)> GetAssumptionCache,
+ function_ref<const TargetLibraryInfo &(Function &)> GetTLI,
+ function_ref<BlockFrequencyInfo &(Function &)> GetBFI = nullptr,
+ ProfileSummaryInfo *PSI = nullptr, OptimizationRemarkEmitter *ORE = nullptr,
+ std::optional<function_ref<EphemeralValuesCache &(Function &)>>
+ GetEphValuesCache = std::nullopt);
----------------
nikic wrote:
function_ref accepts nullptr, so I think it would be better to use `function_ref<EphemeralValuesCache &(Function &)> GetEphValuesCache = nullptr` here, to save the std::optional wrapper. See GetBFI above.
https://github.com/llvm/llvm-project/pull/130210
More information about the llvm-commits
mailing list