Index: lib/Transforms/Scalar/LoopStrengthReduce.cpp =================================================================== --- lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -3423,6 +3423,12 @@ if (AddOps.size() == 1) return; + // For AllFixupsOutsideLoop uses, their reassociations have less impact than + // normal uses since they are outside of current loop. + // Arbitrarily choose a cap size of AddOps to protect compile time. + if (AddOps.size() >= 5 && LU.AllFixupsOutsideLoop) + return; + for (SmallVectorImpl::const_iterator J = AddOps.begin(), JE = AddOps.end(); J != JE; ++J) {