-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[NewPM] Remove BranchProbabilityInfo from FunctionToLoopPassAdaptor. NFCI #159516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…NFCI No loop pass seems to use it after LoopPredication stopped using it in https://reviews.llvm.org/D111668
@llvm/pr-subscribers-llvm-analysis @llvm/pr-subscribers-llvm-transforms Author: Luke Lau (lukel97) ChangesNo loop pass seems to use now it after LoopPredication stopped using it in https://reviews.llvm.org/D111668 Full diff: https://github.com/llvm/llvm-project/pull/159516.diff 4 Files Affected:
diff --git a/llvm/include/llvm/Analysis/LoopAnalysisManager.h b/llvm/include/llvm/Analysis/LoopAnalysisManager.h
index a825ada05df11..a394d45fe8c5f 100644
--- a/llvm/include/llvm/Analysis/LoopAnalysisManager.h
+++ b/llvm/include/llvm/Analysis/LoopAnalysisManager.h
@@ -60,7 +60,6 @@ struct LoopStandardAnalysisResults {
TargetLibraryInfo &TLI;
TargetTransformInfo &TTI;
BlockFrequencyInfo *BFI;
- BranchProbabilityInfo *BPI;
MemorySSA *MSSA;
};
diff --git a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
index 79ccd63fd834c..750f9546625a2 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
@@ -405,11 +405,9 @@ class FunctionToLoopPassAdaptor
explicit FunctionToLoopPassAdaptor(std::unique_ptr<PassConceptT> Pass,
bool UseMemorySSA = false,
bool UseBlockFrequencyInfo = false,
- bool UseBranchProbabilityInfo = false,
bool LoopNestMode = false)
: Pass(std::move(Pass)), UseMemorySSA(UseMemorySSA),
UseBlockFrequencyInfo(UseBlockFrequencyInfo),
- UseBranchProbabilityInfo(UseBranchProbabilityInfo),
LoopNestMode(LoopNestMode) {
LoopCanonicalizationFPM.addPass(LoopSimplifyPass());
LoopCanonicalizationFPM.addPass(LCSSAPass());
@@ -432,7 +430,6 @@ class FunctionToLoopPassAdaptor
bool UseMemorySSA = false;
bool UseBlockFrequencyInfo = false;
- bool UseBranchProbabilityInfo = false;
const bool LoopNestMode;
};
@@ -446,8 +443,7 @@ class FunctionToLoopPassAdaptor
template <typename LoopPassT>
inline FunctionToLoopPassAdaptor
createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA = false,
- bool UseBlockFrequencyInfo = false,
- bool UseBranchProbabilityInfo = false) {
+ bool UseBlockFrequencyInfo = false) {
if constexpr (is_detected<HasRunOnLoopT, LoopPassT>::value) {
using PassModelT =
detail::PassModel<Loop, LoopPassT, LoopAnalysisManager,
@@ -457,7 +453,7 @@ createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA = false,
return FunctionToLoopPassAdaptor(
std::unique_ptr<FunctionToLoopPassAdaptor::PassConceptT>(
new PassModelT(std::forward<LoopPassT>(Pass))),
- UseMemorySSA, UseBlockFrequencyInfo, UseBranchProbabilityInfo, false);
+ UseMemorySSA, UseBlockFrequencyInfo, false);
} else {
LoopPassManager LPM;
LPM.addPass(std::forward<LoopPassT>(Pass));
@@ -469,7 +465,7 @@ createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA = false,
return FunctionToLoopPassAdaptor(
std::unique_ptr<FunctionToLoopPassAdaptor::PassConceptT>(
new PassModelT(std::move(LPM))),
- UseMemorySSA, UseBlockFrequencyInfo, UseBranchProbabilityInfo, true);
+ UseMemorySSA, UseBlockFrequencyInfo, true);
}
}
@@ -477,9 +473,9 @@ createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA = false,
/// be in loop-nest mode if the pass manager contains only loop-nest passes.
template <>
inline FunctionToLoopPassAdaptor
-createFunctionToLoopPassAdaptor<LoopPassManager>(
- LoopPassManager &&LPM, bool UseMemorySSA, bool UseBlockFrequencyInfo,
- bool UseBranchProbabilityInfo) {
+createFunctionToLoopPassAdaptor<LoopPassManager>(LoopPassManager &&LPM,
+ bool UseMemorySSA,
+ bool UseBlockFrequencyInfo) {
// Check if LPM contains any loop pass and if it does not, returns an adaptor
// in loop-nest mode.
using PassModelT =
@@ -491,8 +487,7 @@ createFunctionToLoopPassAdaptor<LoopPassManager>(
return FunctionToLoopPassAdaptor(
std::unique_ptr<FunctionToLoopPassAdaptor::PassConceptT>(
new PassModelT(std::move(LPM))),
- UseMemorySSA, UseBlockFrequencyInfo, UseBranchProbabilityInfo,
- LoopNestMode);
+ UseMemorySSA, UseBlockFrequencyInfo, LoopNestMode);
}
/// Pass for printing a loop's contents as textual IR.
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 8cf277657a54a..4a47dac66a097 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -2098,11 +2098,8 @@ Error PassBuilder::parseFunctionPass(FunctionPassManager &FPM,
bool UseBFI = llvm::any_of(InnerPipeline, [](auto Pipeline) {
return Pipeline.Name.contains("simple-loop-unswitch");
});
- bool UseBPI = llvm::any_of(InnerPipeline, [](auto Pipeline) {
- return Pipeline.Name == "loop-predication";
- });
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM), UseMemorySSA,
- UseBFI, UseBPI));
+ UseBFI));
return Error::success();
}
if (Name == "machine-function") {
diff --git a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
index 4b26ce12a28db..1e72996cddb71 100644
--- a/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopPassManager.cpp
@@ -223,10 +223,6 @@ PreservedAnalyses FunctionToLoopPassAdaptor::run(Function &F,
BlockFrequencyInfo *BFI = UseBlockFrequencyInfo && F.hasProfileData()
? (&AM.getResult<BlockFrequencyAnalysis>(F))
: nullptr;
- BranchProbabilityInfo *BPI =
- UseBranchProbabilityInfo && F.hasProfileData()
- ? (&AM.getResult<BranchProbabilityAnalysis>(F))
- : nullptr;
LoopStandardAnalysisResults LAR = {AM.getResult<AAManager>(F),
AM.getResult<AssumptionAnalysis>(F),
AM.getResult<DominatorTreeAnalysis>(F),
@@ -235,7 +231,6 @@ PreservedAnalyses FunctionToLoopPassAdaptor::run(Function &F,
AM.getResult<TargetLibraryAnalysis>(F),
AM.getResult<TargetIRAnalysis>(F),
BFI,
- BPI,
MSSA};
// Setup the loop analysis manager from its proxy. It is important that
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This was added to illustrate the lossy preservation of BPI in 452714f But it fails now because we don't run OuterAnalysisManagerProxy beforehand. I'm not sure if it's still a useful thing to test given that llvm#159516 removes BPI from the adaptor, so I've gone ahead and deleted the test
No loop pass seems to use now it after LoopPredication stopped using it in https://reviews.llvm.org/D111668