[llvm] f58a642 - [PassBuilder] Use loop-mssa for licm
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 17 12:23:21 PDT 2021
Author: Nikita Popov
Date: 2021-08-17T21:23:11+02:00
New Revision: f58a642da19c64cb6ee1badb0f176a872c1d7a0a
URL: https://github.com/llvm/llvm-project/commit/f58a642da19c64cb6ee1badb0f176a872c1d7a0a
DIFF: https://github.com/llvm/llvm-project/commit/f58a642da19c64cb6ee1badb0f176a872c1d7a0a.diff
LOG: [PassBuilder] Use loop-mssa for licm
Currently specifying -licm or -passes=licm will implicitly create
-passes=loop(licm). This does not match the intended default (used
by the legacy PM and by the default pipeline) of using the
MemorySSA-based LICM implementation. As I plan to drop the non-MSSA
implementation, this will stop working entirely...
This special-cases licm to create a loop-mssa manager instead. At
this point it's still possible to use -passes='loop(licm)' to opt
into the AST-based implementation.
Differential Revision: https://reviews.llvm.org/D108155
Added:
Modified:
llvm/lib/Passes/PassBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 6ac722c335bd..c8dee32d0b01 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -2416,15 +2416,19 @@ static bool isFunctionPassName(StringRef Name, CallbacksT &Callbacks) {
}
template <typename CallbacksT>
-static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks) {
- // Explicitly handle pass manager names.
- if (Name == "loop" || Name == "loop-mssa")
- return true;
+static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks,
+ bool &UseMemorySSA) {
+ UseMemorySSA = false;
// Explicitly handle custom-parsed pass names.
if (parseRepeatPassName(Name))
return true;
+ if (Name == "licm") {
+ UseMemorySSA = true;
+ return true;
+ }
+
#define LOOP_PASS(NAME, CREATE_PASS) \
if (Name == NAME) \
return true;
@@ -3013,13 +3017,16 @@ Error PassBuilder::parsePassPipeline(ModulePassManager &MPM,
StringRef FirstName = Pipeline->front().Name;
if (!isModulePassName(FirstName, ModulePipelineParsingCallbacks)) {
+ bool UseMemorySSA;
if (isCGSCCPassName(FirstName, CGSCCPipelineParsingCallbacks)) {
Pipeline = {{"cgscc", std::move(*Pipeline)}};
} else if (isFunctionPassName(FirstName,
FunctionPipelineParsingCallbacks)) {
Pipeline = {{"function", std::move(*Pipeline)}};
- } else if (isLoopPassName(FirstName, LoopPipelineParsingCallbacks)) {
- Pipeline = {{"function", {{"loop", std::move(*Pipeline)}}}};
+ } else if (isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
+ UseMemorySSA)) {
+ Pipeline = {{"function", {{UseMemorySSA ? "loop-mssa" : "loop",
+ std::move(*Pipeline)}}}};
} else {
for (auto &C : TopLevelPipelineParsingCallbacks)
if (C(MPM, *Pipeline))
More information about the llvm-commits
mailing list