[PATCH] D108155: [PassBuilder] Use loop-mssa for licm

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 12:07:06 PDT 2021


nikic created this revision.
nikic added reviewers: asbirlea, aeubanks.
Herald added subscribers: george.burgess.iv, hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108155

Files:
  llvm/lib/Passes/PassBuilder.cpp


Index: llvm/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -2416,15 +2416,19 @@
 }
 
 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 @@
   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))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108155.366705.patch
Type: text/x-patch
Size: 1886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210816/838a6f05/attachment.bin>


More information about the llvm-commits mailing list