[NFCI][IndVars] rewriteLoopExitValues(): don't expand SCEV's until needed
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 30 Aug 2021 09:27:41 +0000 (12:27 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 30 Aug 2021 09:28:24 +0000 (12:28 +0300)
commit795d142d237e0a06c136886a6dd9c49235c37295
tree5573117a52fc18909ba0eb83886b3988c3d3be19
parentb1b68b4c0190b7fc7f0ebe823277966056b39494
[NFCI][IndVars] rewriteLoopExitValues(): don't expand SCEV's until needed

Previously, we'd expand *ALL* the SCEV's eagerly, because we needed to
check with `isValidRewrite()`, and discard bad rewrite candidates,
but now that we do not do that, we also don't need to always expand.

In particular, this avoids expanding potentially-huge SCEV's that we
would discard anyways because they are high-cost and we aren't
rewriting aggressively.
llvm/lib/Transforms/Utils/LoopUtils.cpp