[llvm] 0d06b14 - [MLGO] Fix use of AM.invalidate post D100519
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 15 18:45:47 PDT 2021
Author: Mircea Trofin
Date: 2021-04-15T18:45:39-07:00
New Revision: 0d06b14f59d17de400b0513f178fcd4743fd288f
URL: https://github.com/llvm/llvm-project/commit/0d06b14f59d17de400b0513f178fcd4743fd288f
DIFF: https://github.com/llvm/llvm-project/commit/0d06b14f59d17de400b0513f178fcd4743fd288f.diff
LOG: [MLGO] Fix use of AM.invalidate post D100519
The ML inline advisors more aggressively invalidate certain analyses
after each call site inlining, to more accurately capture the problem
state.
Added:
Modified:
llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
llvm/lib/Analysis/MLInlineAdvisor.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp b/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
index e138e82c8b05b..940eb01f760f3 100644
--- a/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
+++ b/llvm/lib/Analysis/DevelopmentModeInlineAdvisor.cpp
@@ -160,7 +160,9 @@ class DevelopmentModeMLInlineAdvisor : public MLInlineAdvisor {
*CurrentNativeSize += Change;
}
void resetNativeSize(Function *F) {
- FAM.invalidate<InlineSizeEstimatorAnalysis>(*F);
+ PreservedAnalyses PA = PreservedAnalyses::all();
+ PA.abandon<InlineSizeEstimatorAnalysis>();
+ FAM.invalidate(*F, PA);
}
std::unique_ptr<MLInlineAdvice>
diff --git a/llvm/lib/Analysis/MLInlineAdvisor.cpp b/llvm/lib/Analysis/MLInlineAdvisor.cpp
index 89f4ff427dffb..5ef460960f283 100644
--- a/llvm/lib/Analysis/MLInlineAdvisor.cpp
+++ b/llvm/lib/Analysis/MLInlineAdvisor.cpp
@@ -134,7 +134,11 @@ void MLInlineAdvisor::onSuccessfulInlining(const MLInlineAdvice &Advice,
Function *Callee = Advice.getCallee();
// The caller features aren't valid anymore.
- FAM.invalidate<FunctionPropertiesAnalysis>(*Caller);
+ {
+ PreservedAnalyses PA = PreservedAnalyses::all();
+ PA.abandon<FunctionPropertiesAnalysis>();
+ FAM.invalidate(*Caller, PA);
+ }
int64_t IRSizeAfter =
getIRSize(*Caller) + (CalleeWasDeleted ? 0 : Advice.CalleeIRSize);
CurrentIRSize += IRSizeAfter - (Advice.CallerIRSize + Advice.CalleeIRSize);
More information about the llvm-commits
mailing list