aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorvporpo <vporpodas@google.com>2025-03-21 18:18:03 -0700
committerGitHub <noreply@github.com>2025-03-21 18:18:03 -0700
commit4adefcfb856aa304b7b0a9de1eec1814f3820e83 (patch)
tree6d6c715d16ccf1bde1b73cbbd6d11f6665ff62b1 /llvm/lib/Analysis/InlineCost.cpp
parentc0b2c10e9f3a939c227a26aec3ba377f7cc25667 (diff)
downloadllvm-4adefcfb856aa304b7b0a9de1eec1814f3820e83.zip
llvm-4adefcfb856aa304b7b0a9de1eec1814f3820e83.tar.gz
llvm-4adefcfb856aa304b7b0a9de1eec1814f3820e83.tar.bz2
[Analysis][EphemeralValuesAnalysis][NFCI] Remove EphemeralValuesCache class (#132454)
This is a follow-up to https://github.com/llvm/llvm-project/pull/130210. The EphemeralValuesAnalysis pass used to return an EphemeralValuesCache object which used to hold the ephemeral values and used to provide a lazy collection of the ephemeral values, and an invalidation using the `clear()` function. This patch removes the EphemeralValuesCache class completely and instead returns the SmallVector containing the ephemeral values.
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index df212eb3..76c3dd8 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -271,7 +271,8 @@ protected:
CallBase &CandidateCall;
/// Getter for the cache of ephemeral values.
- function_ref<EphemeralValuesCache &(Function &)> GetEphValuesCache = nullptr;
+ function_ref<EphemeralValuesAnalysis::Result &(Function &)>
+ GetEphValuesCache = nullptr;
/// Extension points for handling callsite features.
// Called before a basic block was analyzed.
@@ -515,8 +516,8 @@ public:
function_ref<const TargetLibraryInfo &(Function &)> GetTLI = nullptr,
ProfileSummaryInfo *PSI = nullptr,
OptimizationRemarkEmitter *ORE = nullptr,
- function_ref<EphemeralValuesCache &(Function &)> GetEphValuesCache =
- nullptr)
+ function_ref<EphemeralValuesAnalysis::Result &(Function &)>
+ GetEphValuesCache = nullptr)
: TTI(TTI), GetAssumptionCache(GetAssumptionCache), GetBFI(GetBFI),
GetTLI(GetTLI), PSI(PSI), F(Callee), DL(F.getDataLayout()), ORE(ORE),
CandidateCall(Call), GetEphValuesCache(GetEphValuesCache) {}
@@ -1133,8 +1134,8 @@ public:
ProfileSummaryInfo *PSI = nullptr,
OptimizationRemarkEmitter *ORE = nullptr, bool BoostIndirect = true,
bool IgnoreThreshold = false,
- function_ref<EphemeralValuesCache &(Function &)> GetEphValuesCache =
- nullptr)
+ function_ref<EphemeralValuesAnalysis::Result &(Function &)>
+ GetEphValuesCache = nullptr)
: CallAnalyzer(Callee, Call, TTI, GetAssumptionCache, GetBFI, GetTLI, PSI,
ORE, GetEphValuesCache),
ComputeFullInlineCost(OptComputeFullInlineCost ||
@@ -2794,7 +2795,7 @@ InlineResult CallAnalyzer::analyze() {
SmallPtrSet<const Value *, 32> EphValuesStorage;
const SmallPtrSetImpl<const Value *> *EphValues = &EphValuesStorage;
if (GetEphValuesCache)
- EphValues = &GetEphValuesCache(F).ephValues();
+ EphValues = &GetEphValuesCache(F);
else
CodeMetrics::collectEphemeralValues(&F, &GetAssumptionCache(F),
EphValuesStorage);
@@ -2980,7 +2981,8 @@ InlineCost llvm::getInlineCost(
function_ref<const TargetLibraryInfo &(Function &)> GetTLI,
function_ref<BlockFrequencyInfo &(Function &)> GetBFI,
ProfileSummaryInfo *PSI, OptimizationRemarkEmitter *ORE,
- function_ref<EphemeralValuesCache &(Function &)> GetEphValuesCache) {
+ function_ref<EphemeralValuesAnalysis::Result &(Function &)>
+ GetEphValuesCache) {
return getInlineCost(Call, Call.getCalledFunction(), Params, CalleeTTI,
GetAssumptionCache, GetTLI, GetBFI, PSI, ORE,
GetEphValuesCache);
@@ -3104,7 +3106,8 @@ InlineCost llvm::getInlineCost(
function_ref<const TargetLibraryInfo &(Function &)> GetTLI,
function_ref<BlockFrequencyInfo &(Function &)> GetBFI,
ProfileSummaryInfo *PSI, OptimizationRemarkEmitter *ORE,
- function_ref<EphemeralValuesCache &(Function &)> GetEphValuesCache) {
+ function_ref<EphemeralValuesAnalysis::Result &(Function &)>
+ GetEphValuesCache) {
auto UserDecision =
llvm::getAttributeBasedInliningDecision(Call, Callee, CalleeTTI, GetTLI);