From: Nikita Popov Date: Mon, 16 Aug 2021 18:58:31 +0000 (+0200) Subject: [PassBuilder] Use loop-mssa for licm X-Git-Tag: upstream/15.0.7~33708 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f58a642da19c64cb6ee1badb0f176a872c1d7a0a;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 6ac722c..c8dee32 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 -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))