[llvm] 8a00386 - [NPM] Add -enable-loopinterchange option to NPM
Ta-Wei Tu via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 6 10:39:34 PST 2021
Author: Ta-Wei Tu
Date: 2021-03-07T02:39:28+08:00
New Revision: 8a003861a31af171974f9831d26d94f2ae964497
URL: https://github.com/llvm/llvm-project/commit/8a003861a31af171974f9831d26d94f2ae964497
DIFF: https://github.com/llvm/llvm-project/commit/8a003861a31af171974f9831d26d94f2ae964497.diff
LOG: [NPM] Add -enable-loopinterchange option to NPM
We have the `enable-loopinterchange` option in legacy pass manager but not in NPM.
Add `LoopInterchange` pass to the optimization pipeline (at the same position as before)
when `enable-loopinterchange` is turned on.
Reviewed By: aeubanks, fhahn
Differential Revision: https://reviews.llvm.org/D98116
Added:
Modified:
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 52f7026c40eb..12ed8ee8b05f 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -301,6 +301,7 @@ extern cl::opt<bool> EnableHotColdSplit;
extern cl::opt<bool> EnableIROutliner;
extern cl::opt<bool> EnableOrderFileInstrumentation;
extern cl::opt<bool> EnableCHR;
+extern cl::opt<bool> EnableLoopInterchange;
extern cl::opt<bool> EnableUnrollAndJam;
extern cl::opt<bool> EnableLoopFlatten;
extern cl::opt<bool> RunNewGVN;
@@ -582,6 +583,10 @@ PassBuilder::buildO1FunctionSimplificationPipeline(OptimizationLevel Level,
C(LPM2, Level);
LPM2.addPass(LoopDeletionPass());
+
+ if (EnableLoopInterchange)
+ LPM2.addPass(LoopInterchangePass());
+
// Do not enable unrolling in PreLinkThinLTO phase during sample PGO
// because it changes IR to makes profile annotation in back compile
// inaccurate. The normal unroller doesn't pay attention to forced full unroll
@@ -748,6 +753,10 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
C(LPM2, Level);
LPM2.addPass(LoopDeletionPass());
+
+ if (EnableLoopInterchange)
+ LPM2.addPass(LoopInterchangePass());
+
// Do not enable unrolling in PreLinkThinLTO phase during sample PGO
// because it changes IR to makes profile annotation in back compile
// inaccurate. The normal unroller doesn't pay attention to forced full unroll
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index 3b495dd71c2c..109e7c97ff1b 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -84,9 +84,9 @@ static cl::opt<::CFLAAType>
clEnumValN(::CFLAAType::Both, "both",
"Enable both variants of CFL-AA")));
-static cl::opt<bool> EnableLoopInterchange(
+cl::opt<bool> EnableLoopInterchange(
"enable-loopinterchange", cl::init(false), cl::Hidden,
- cl::desc("Enable the new, experimental LoopInterchange Pass"));
+ cl::desc("Enable the experimental LoopInterchange Pass"));
cl::opt<bool> EnableUnrollAndJam("enable-unroll-and-jam", cl::init(false),
cl::Hidden,
More information about the llvm-commits
mailing list