[llvm] 016022e - Recommit "[LoopFlatten] Move it to a LoopPassManager"
Sjoerd Meijer via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 19 06:38:32 PST 2022
Author: Sjoerd Meijer
Date: 2022-01-19T14:38:05Z
New Revision: 016022e5daa821cf22fe3bcfb89878a21fe88937
URL: https://github.com/llvm/llvm-project/commit/016022e5daa821cf22fe3bcfb89878a21fe88937
DIFF: https://github.com/llvm/llvm-project/commit/016022e5daa821cf22fe3bcfb89878a21fe88937.diff
LOG: Recommit "[LoopFlatten] Move it to a LoopPassManager"
This was reverted because of a performance regression, which is fixed by
D116612 that I will commit directly after this change.
This reverts commit e92d63b467e13227408f9726fbd66d07cc58811c.
Added:
Modified:
llvm/lib/Passes/PassBuilderPipelines.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index a6a36ff254029..79c42b886fbbe 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -311,6 +311,8 @@ PassBuilder::buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
if (EnableLoopInterchange)
LPM2.addPass(LoopInterchangePass());
+ if (EnableLoopFlatten)
+ LPM2.addPass(LoopFlattenPass());
// Do not enable unrolling in PreLinkThinLTO phase during sample PGO
// because it changes IR to makes profile annotation in back compile
@@ -335,8 +337,6 @@ PassBuilder::buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
/*UseBlockFrequencyInfo=*/true));
FPM.addPass(SimplifyCFGPass());
FPM.addPass(InstCombinePass());
- if (EnableLoopFlatten)
- FPM.addPass(createFunctionToLoopPassAdaptor(LoopFlattenPass()));
// The loop passes in LPM2 (LoopFullUnrollPass) do not preserve MemorySSA.
// *All* loop passes must preserve it, in order to be able to use it.
FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM2),
@@ -485,6 +485,8 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
if (EnableLoopInterchange)
LPM2.addPass(LoopInterchangePass());
+ if (EnableLoopFlatten)
+ LPM2.addPass(LoopFlattenPass());
// Do not enable unrolling in PreLinkThinLTO phase during sample PGO
// because it changes IR to makes profile annotation in back compile
@@ -509,8 +511,6 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
/*UseBlockFrequencyInfo=*/true));
FPM.addPass(SimplifyCFGPass());
FPM.addPass(InstCombinePass());
- if (EnableLoopFlatten)
- FPM.addPass(createFunctionToLoopPassAdaptor(LoopFlattenPass()));
// The loop passes in LPM2 (LoopIdiomRecognizePass, IndVarSimplifyPass,
// LoopDeletionPass and LoopFullUnrollPass) do not preserve MemorySSA.
// *All* loop passes must preserve it, in order to be able to use it.
@@ -1623,9 +1623,6 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
MainFPM.addPass(DSEPass());
MainFPM.addPass(MergedLoadStoreMotionPass());
- // More loops are countable; try to optimize them.
- if (EnableLoopFlatten && Level.getSpeedupLevel() > 1)
- MainFPM.addPass(createFunctionToLoopPassAdaptor(LoopFlattenPass()));
if (EnableConstraintElimination)
MainFPM.addPass(ConstraintEliminationPass());
@@ -1633,6 +1630,8 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
LoopPassManager LPM;
LPM.addPass(IndVarSimplifyPass());
LPM.addPass(LoopDeletionPass());
+ if (EnableLoopFlatten && Level.getSpeedupLevel() > 1)
+ LPM.addPass(LoopFlattenPass());
// FIXME: Add loop interchange.
// Unroll small loops and perform peeling.
More information about the llvm-commits
mailing list