Changeset View
Changeset View
Standalone View
Standalone View
lib/Transforms/IPO/PassManagerBuilder.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
static cl::opt<bool> UseCFLAA("use-cfl-aa", | static cl::opt<bool> UseCFLAA("use-cfl-aa", | ||||
cl::init(false), cl::Hidden, | cl::init(false), cl::Hidden, | ||||
cl::desc("Enable the new, experimental CFL alias analysis")); | cl::desc("Enable the new, experimental CFL alias analysis")); | ||||
static cl::opt<bool> | static cl::opt<bool> | ||||
EnableMLSM("mlsm", cl::init(true), cl::Hidden, | EnableMLSM("mlsm", cl::init(true), cl::Hidden, | ||||
cl::desc("Enable motion of merged load and store")); | cl::desc("Enable motion of merged load and store")); | ||||
static cl::opt<bool> EnableLoopInterchange( | |||||
"enable-loopinterchange", cl::init(false), cl::Hidden, | |||||
cl::desc("Enable the new, experimental LoopInterchange Pass")); | |||||
PassManagerBuilder::PassManagerBuilder() { | PassManagerBuilder::PassManagerBuilder() { | ||||
OptLevel = 2; | OptLevel = 2; | ||||
SizeLevel = 0; | SizeLevel = 0; | ||||
LibraryInfo = nullptr; | LibraryInfo = nullptr; | ||||
Inliner = nullptr; | Inliner = nullptr; | ||||
DisableTailCalls = false; | DisableTailCalls = false; | ||||
DisableUnitAtATime = false; | DisableUnitAtATime = false; | ||||
DisableUnrollLoops = false; | DisableUnrollLoops = false; | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | void PassManagerBuilder::populateModulePassManager( | ||||
// Rotate Loop - disable header duplication at -Oz | // Rotate Loop - disable header duplication at -Oz | ||||
MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1)); | MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1)); | ||||
MPM.add(createLICMPass()); // Hoist loop invariants | MPM.add(createLICMPass()); // Hoist loop invariants | ||||
MPM.add(createLoopUnswitchPass(SizeLevel || OptLevel < 3)); | MPM.add(createLoopUnswitchPass(SizeLevel || OptLevel < 3)); | ||||
MPM.add(createInstructionCombiningPass()); | MPM.add(createInstructionCombiningPass()); | ||||
MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars | MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars | ||||
MPM.add(createLoopIdiomPass()); // Recognize idioms like memset. | MPM.add(createLoopIdiomPass()); // Recognize idioms like memset. | ||||
MPM.add(createLoopDeletionPass()); // Delete dead loops | MPM.add(createLoopDeletionPass()); // Delete dead loops | ||||
if (EnableLoopInterchange) | |||||
MPM.add(createLoopInterchangePass()); // Interchange loops | |||||
if (!DisableUnrollLoops) | if (!DisableUnrollLoops) | ||||
MPM.add(createSimpleLoopUnrollPass()); // Unroll small loops | MPM.add(createSimpleLoopUnrollPass()); // Unroll small loops | ||||
addExtensionsToPM(EP_LoopOptimizerEnd, MPM); | addExtensionsToPM(EP_LoopOptimizerEnd, MPM); | ||||
if (OptLevel > 1) { | if (OptLevel > 1) { | ||||
if (EnableMLSM) | if (EnableMLSM) | ||||
MPM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds | MPM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds | ||||
Show All 12 Lines | void PassManagerBuilder::populateModulePassManager( | ||||
MPM.add(createInstructionCombiningPass()); | MPM.add(createInstructionCombiningPass()); | ||||
addExtensionsToPM(EP_Peephole, MPM); | addExtensionsToPM(EP_Peephole, MPM); | ||||
MPM.add(createJumpThreadingPass()); // Thread jumps | MPM.add(createJumpThreadingPass()); // Thread jumps | ||||
MPM.add(createCorrelatedValuePropagationPass()); | MPM.add(createCorrelatedValuePropagationPass()); | ||||
MPM.add(createDeadStoreEliminationPass()); // Delete dead stores | MPM.add(createDeadStoreEliminationPass()); // Delete dead stores | ||||
MPM.add(createLICMPass()); | MPM.add(createLICMPass()); | ||||
addExtensionsToPM(EP_ScalarOptimizerLate, MPM); | addExtensionsToPM(EP_ScalarOptimizerLate, MPM); | ||||
hfinkel: I'd certainly like to have this on by default eventually, but we should be more conservative at… | |||||
Not Done ReplyInline ActionsSure. I had added it for testing performance forgot to revert before checkin. Will add a command line flag and disable it by default. karthikthecool: Sure. I had added it for testing performance forgot to revert before checkin. Will add a… | |||||
if (RerollLoops) | if (RerollLoops) | ||||
MPM.add(createLoopRerollPass()); | MPM.add(createLoopRerollPass()); | ||||
if (!RunSLPAfterLoopVectorization) { | if (!RunSLPAfterLoopVectorization) { | ||||
if (SLPVectorize) | if (SLPVectorize) | ||||
MPM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains. | MPM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains. | ||||
if (BBVectorize) { | if (BBVectorize) { | ||||
MPM.add(createBBVectorizePass()); | MPM.add(createBBVectorizePass()); | ||||
▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) { | ||||
PM.add(createMemCpyOptPass()); // Remove dead memcpys. | PM.add(createMemCpyOptPass()); // Remove dead memcpys. | ||||
// Nuke dead stores. | // Nuke dead stores. | ||||
PM.add(createDeadStoreEliminationPass()); | PM.add(createDeadStoreEliminationPass()); | ||||
// More loops are countable; try to optimize them. | // More loops are countable; try to optimize them. | ||||
PM.add(createIndVarSimplifyPass()); | PM.add(createIndVarSimplifyPass()); | ||||
PM.add(createLoopDeletionPass()); | PM.add(createLoopDeletionPass()); | ||||
if (EnableLoopInterchange) | |||||
PM.add(createLoopInterchangePass()); | |||||
PM.add(createLoopVectorizePass(true, LoopVectorize)); | PM.add(createLoopVectorizePass(true, LoopVectorize)); | ||||
// More scalar chains could be vectorized due to more alias information | // More scalar chains could be vectorized due to more alias information | ||||
if (RunSLPAfterLoopVectorization) | if (RunSLPAfterLoopVectorization) | ||||
if (SLPVectorize) | if (SLPVectorize) | ||||
PM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains. | PM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains. | ||||
// After vectorization, assume intrinsics may tell us more about pointer | // After vectorization, assume intrinsics may tell us more about pointer | ||||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |
I'd certainly like to have this on by default eventually, but we should be more conservative at first. Please add a command-line flag to enable this (there are several in this file already), so we can do further testing.