Index: lib/Transforms/IPO/PassManagerBuilder.cpp =================================================================== --- lib/Transforms/IPO/PassManagerBuilder.cpp +++ lib/Transforms/IPO/PassManagerBuilder.cpp @@ -70,6 +70,10 @@ cl::init(false), cl::Hidden, cl::desc("Enable the new, experimental CFL alias analysis")); +static cl::opt +EnableMLSM("mlsm", cl::desc("Enable motion of merged load and store"), + cl::init(true)); + PassManagerBuilder::PassManagerBuilder() { OptLevel = 2; SizeLevel = 0; @@ -228,7 +232,9 @@ addExtensionsToPM(EP_LoopOptimizerEnd, MPM); if (OptLevel > 1) { - MPM.add(createMergedLoadStoreMotionPass()); // Merge load/stores in diamond + if (EnableMLSM) + MPM.add( + createMergedLoadStoreMotionPass()); // Merge load/stores in diamond MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies } MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset @@ -388,7 +394,8 @@ PM.add(createGlobalsModRefPass()); // IP alias analysis. PM.add(createLICMPass()); // Hoist loop invariants. - PM.add(createMergedLoadStoreMotionPass()); // Merge load/stores in diamonds + if (EnableMLSM) + PM.add(createMergedLoadStoreMotionPass()); // Merge load/stores in diamonds PM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies. PM.add(createMemCpyOptPass()); // Remove dead memcpys. Index: lib/Transforms/Scalar/MergedLoadStoreMotion.cpp =================================================================== --- lib/Transforms/Scalar/MergedLoadStoreMotion.cpp +++ lib/Transforms/Scalar/MergedLoadStoreMotion.cpp @@ -97,9 +97,6 @@ //===----------------------------------------------------------------------===// // MergedLoadStoreMotion Pass //===----------------------------------------------------------------------===// -static cl::opt -EnableMLSM("mlsm", cl::desc("Enable motion of merged load and store"), - cl::init(true)); namespace { class MergedLoadStoreMotion : public FunctionPass { @@ -611,8 +608,6 @@ AA = &getAnalysis(); bool Changed = false; - if (!EnableMLSM) - return false; DEBUG(dbgs() << "Instruction Merger\n"); // Merge unconditional branches, allowing PRE to catch more