diff --git a/lib/Passes/PassBuilder.cpp b/lib/Passes/PassBuilder.cpp index 52f7026c40e..12ed8ee8b05 100644 --- a/lib/Passes/PassBuilder.cpp +++ b/lib/Passes/PassBuilder.cpp @@ -301,6 +301,7 @@ extern cl::opt EnableHotColdSplit; extern cl::opt EnableIROutliner; extern cl::opt EnableOrderFileInstrumentation; extern cl::opt EnableCHR; +extern cl::opt EnableLoopInterchange; extern cl::opt EnableUnrollAndJam; extern cl::opt EnableLoopFlatten; extern cl::opt 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/lib/Transforms/IPO/PassManagerBuilder.cpp b/lib/Transforms/IPO/PassManagerBuilder.cpp index 3b495dd71c2..109e7c97ff1 100644 --- a/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/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 EnableLoopInterchange( +cl::opt 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 EnableUnrollAndJam("enable-unroll-and-jam", cl::init(false), cl::Hidden,