Index: lib/Transforms/IPO/PassManagerBuilder.cpp =================================================================== --- lib/Transforms/IPO/PassManagerBuilder.cpp +++ lib/Transforms/IPO/PassManagerBuilder.cpp @@ -570,10 +570,15 @@ // More loops are countable; try to optimize them. PM.add(createIndVarSimplifyPass()); PM.add(createLoopDeletionPass()); + if (!DisableUnrollLoops) + PM.add(createSimpleLoopUnrollPass()); // Unroll small loops if (EnableLoopInterchange) PM.add(createLoopInterchangePass()); PM.add(createLoopVectorizePass(true, LoopVectorize)); + // The vectorizer may have significantly shortened a loop body; unroll again. + if (!DisableUnrollLoops) + PM.add(createLoopUnrollPass()); // Now that we've optimized loops (in particular loop induction variables), // we may have exposed more scalar opportunities. Run parts of the scalar