Skip to content

Commit cbcf123

Browse files
committed
[LegacyPM] Remove cl::opts controlling optimization pass manager passes
Move these to the new PM if they're used there. Part of removing the legacy pass manager for optimization pipeline. Reland with UseNewGVN usage in clang removed. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D137915
1 parent 637ed52 commit cbcf123

File tree

3 files changed

+99
-286
lines changed

3 files changed

+99
-286
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
#include "llvm/Transforms/Scalar/GVN.h"
8484
#include "llvm/Transforms/Scalar/JumpThreading.h"
8585
#include "llvm/Transforms/Scalar/LowerMatrixIntrinsics.h"
86-
#include "llvm/Transforms/Scalar/NewGVN.h"
8786
#include "llvm/Transforms/Utils.h"
8887
#include "llvm/Transforms/Utils/CanonicalizeAliases.h"
8988
#include "llvm/Transforms/Utils/Debugify.h"
@@ -101,7 +100,6 @@ using namespace llvm;
101100

102101
namespace llvm {
103102
extern cl::opt<bool> DebugInfoCorrelate;
104-
extern cl::opt<bool> RunNewGVN;
105103

106104
// Experiment to move sanitizers earlier.
107105
static cl::opt<bool> ClSanitizeOnOptimizerEarlyEP(
@@ -676,10 +674,7 @@ static void addSanitizers(const Triple &TargetTriple,
676674
FPM.addPass(EarlyCSEPass(true /* Enable mem-ssa. */));
677675
FPM.addPass(InstCombinePass());
678676
FPM.addPass(JumpThreadingPass());
679-
if (RunNewGVN)
680-
FPM.addPass(NewGVNPass());
681-
else
682-
FPM.addPass(GVNPass());
677+
FPM.addPass(GVNPass());
683678
FPM.addPass(InstCombinePass());
684679
MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
685680
}

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 97 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ static cl::opt<InliningAdvisorMode> UseInlineAdvisor(
134134
"enable-ml-inliner", cl::init(InliningAdvisorMode::Default), cl::Hidden,
135135
cl::desc("Enable ML policy for inliner. Currently trained for -Oz only"),
136136
cl::values(clEnumValN(InliningAdvisorMode::Default, "default",
137-
"Heuristics-based inliner version."),
137+
"Heuristics-based inliner version"),
138138
clEnumValN(InliningAdvisorMode::Development, "development",
139-
"Use development mode (runtime-loadable model)."),
139+
"Use development mode (runtime-loadable model)"),
140140
clEnumValN(InliningAdvisorMode::Release, "release",
141-
"Use release mode (AOT-compiled model).")));
141+
"Use release mode (AOT-compiled model)")));
142142

143143
static cl::opt<bool> EnableSyntheticCounts(
144144
"enable-npm-synthetic-counts", cl::Hidden,
@@ -161,7 +161,7 @@ static cl::opt<bool> EnableModuleInliner("enable-module-inliner",
161161
static cl::opt<bool> PerformMandatoryInliningsFirst(
162162
"mandatory-inlining-first", cl::init(true), cl::Hidden,
163163
cl::desc("Perform mandatory inlinings module-wide, before performing "
164-
"inlining."));
164+
"inlining"));
165165

166166
static cl::opt<bool> EnableO3NonTrivialUnswitching(
167167
"enable-npm-O3-nontrivial-unswitch", cl::init(true), cl::Hidden,
@@ -190,6 +190,99 @@ static cl::opt<bool> EnableGlobalAnalyses(
190190
"enable-global-analyses", cl::init(true), cl::Hidden,
191191
cl::desc("Enable inter-procedural analyses"));
192192

193+
static cl::opt<bool>
194+
RunPartialInlining("enable-partial-inlining", cl::init(false), cl::Hidden,
195+
cl::desc("Run Partial inlinining pass"));
196+
197+
static cl::opt<bool> ExtraVectorizerPasses(
198+
"extra-vectorizer-passes", cl::init(false), cl::Hidden,
199+
cl::desc("Run cleanup optimization passes after vectorization"));
200+
201+
static cl::opt<bool> RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden,
202+
cl::desc("Run the NewGVN pass"));
203+
204+
static cl::opt<bool> EnableLoopInterchange(
205+
"enable-loopinterchange", cl::init(false), cl::Hidden,
206+
cl::desc("Enable the experimental LoopInterchange Pass"));
207+
208+
static cl::opt<bool> EnableUnrollAndJam("enable-unroll-and-jam",
209+
cl::init(false), cl::Hidden,
210+
cl::desc("Enable Unroll And Jam Pass"));
211+
212+
static cl::opt<bool> EnableLoopFlatten("enable-loop-flatten", cl::init(false),
213+
cl::Hidden,
214+
cl::desc("Enable the LoopFlatten Pass"));
215+
216+
static cl::opt<bool>
217+
EnableDFAJumpThreading("enable-dfa-jump-thread",
218+
cl::desc("Enable DFA jump threading"),
219+
cl::init(false), cl::Hidden);
220+
221+
static cl::opt<bool>
222+
EnableHotColdSplit("hot-cold-split",
223+
cl::desc("Enable hot-cold splitting pass"));
224+
225+
static cl::opt<bool> EnableIROutliner("ir-outliner", cl::init(false),
226+
cl::Hidden,
227+
cl::desc("Enable ir outliner pass"));
228+
229+
static cl::opt<bool>
230+
DisablePreInliner("disable-preinline", cl::init(false), cl::Hidden,
231+
cl::desc("Disable pre-instrumentation inliner"));
232+
233+
static cl::opt<int> PreInlineThreshold(
234+
"preinline-threshold", cl::Hidden, cl::init(75),
235+
cl::desc("Control the amount of inlining in pre-instrumentation inliner "
236+
"(default = 75)"));
237+
238+
static cl::opt<bool>
239+
EnableGVNHoist("enable-gvn-hoist",
240+
cl::desc("Enable the GVN hoisting pass (default = off)"));
241+
242+
static cl::opt<bool>
243+
EnableGVNSink("enable-gvn-sink",
244+
cl::desc("Enable the GVN sinking pass (default = off)"));
245+
246+
// This option is used in simplifying testing SampleFDO optimizations for
247+
// profile loading.
248+
static cl::opt<bool>
249+
EnableCHR("enable-chr", cl::init(true), cl::Hidden,
250+
cl::desc("Enable control height reduction optimization (CHR)"));
251+
252+
static cl::opt<bool> FlattenedProfileUsed(
253+
"flattened-profile-used", cl::init(false), cl::Hidden,
254+
cl::desc("Indicate the sample profile being used is flattened, i.e., "
255+
"no inline hierachy exists in the profile"));
256+
257+
static cl::opt<bool> EnableOrderFileInstrumentation(
258+
"enable-order-file-instrumentation", cl::init(false), cl::Hidden,
259+
cl::desc("Enable order file instrumentation (default = off)"));
260+
261+
static cl::opt<bool>
262+
EnableMatrix("enable-matrix", cl::init(false), cl::Hidden,
263+
cl::desc("Enable lowering of the matrix intrinsics"));
264+
265+
static cl::opt<bool> EnableConstraintElimination(
266+
"enable-constraint-elimination", cl::init(false), cl::Hidden,
267+
cl::desc(
268+
"Enable pass to eliminate conditions based on linear constraints"));
269+
270+
static cl::opt<bool> EnableFunctionSpecialization(
271+
"enable-function-specialization", cl::init(false), cl::Hidden,
272+
cl::desc("Enable Function Specialization pass"));
273+
274+
static cl::opt<AttributorRunOption> AttributorRun(
275+
"attributor-enable", cl::Hidden, cl::init(AttributorRunOption::NONE),
276+
cl::desc("Enable the attributor inter-procedural deduction pass"),
277+
cl::values(clEnumValN(AttributorRunOption::ALL, "all",
278+
"enable all attributor runs"),
279+
clEnumValN(AttributorRunOption::MODULE, "module",
280+
"enable module-wide attributor runs"),
281+
clEnumValN(AttributorRunOption::CGSCC, "cgscc",
282+
"enable call graph SCC attributor runs"),
283+
clEnumValN(AttributorRunOption::NONE, "none",
284+
"disable attributor runs")));
285+
193286
PipelineTuningOptions::PipelineTuningOptions() {
194287
LoopInterleaving = true;
195288
LoopVectorization = true;
@@ -206,27 +299,7 @@ PipelineTuningOptions::PipelineTuningOptions() {
206299

207300
namespace llvm {
208301
extern cl::opt<unsigned> MaxDevirtIterations;
209-
extern cl::opt<bool> EnableConstraintElimination;
210-
extern cl::opt<bool> EnableFunctionSpecialization;
211-
extern cl::opt<bool> EnableGVNHoist;
212-
extern cl::opt<bool> EnableGVNSink;
213-
extern cl::opt<bool> EnableHotColdSplit;
214-
extern cl::opt<bool> EnableIROutliner;
215-
extern cl::opt<bool> EnableOrderFileInstrumentation;
216-
extern cl::opt<bool> EnableCHR;
217-
extern cl::opt<bool> EnableLoopInterchange;
218-
extern cl::opt<bool> EnableUnrollAndJam;
219-
extern cl::opt<bool> EnableLoopFlatten;
220-
extern cl::opt<bool> EnableDFAJumpThreading;
221-
extern cl::opt<bool> RunNewGVN;
222-
extern cl::opt<bool> RunPartialInlining;
223-
extern cl::opt<bool> ExtraVectorizerPasses;
224-
extern cl::opt<bool> FlattenedProfileUsed;
225-
extern cl::opt<AttributorRunOption> AttributorRun;
226302
extern cl::opt<bool> EnableKnowledgeRetention;
227-
extern cl::opt<bool> EnableMatrix;
228-
extern cl::opt<bool> DisablePreInliner;
229-
extern cl::opt<int> PreInlineThreshold;
230303
} // namespace llvm
231304

232305
void PassBuilder::invokePeepholeEPCallbacks(FunctionPassManager &FPM,

0 commit comments

Comments
 (0)