[SCEV] Ensure that isHighCostExpansion takes into account what is being divided
authorDavid Green <david.green@arm.com>
Tue, 5 Mar 2019 12:12:18 +0000 (12:12 +0000)
committerDavid Green <david.green@arm.com>
Tue, 5 Mar 2019 12:12:18 +0000 (12:12 +0000)
commit4511f3fa86de9579ded704b66a52492bc7ca08de
tree61793008d5b9fefbac3be9b5a1b7f72c9c1627a8
parent7523f743b4c0bbf59bb9dfd806fce43fbc4eb1ca
[SCEV] Ensure that isHighCostExpansion takes into account what is being divided

A SCEV is not low-cost just because you can divide it by a power of 2. We need to also
check what we are dividing to make sure it too is not a high-code expansion. This helps
to not expand the exit value of certain loops, helping not to bloat the code.

The change in no-iv-rewrite.ll is reverting back to what it was testing before rL194116,
and looks a lot like the other tests in replace-loop-exit-folds.ll.

Differential Revision: https://reviews.llvm.org/D58435

llvm-svn: 355393
llvm/lib/Analysis/ScalarEvolutionExpander.cpp
llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
llvm/test/Transforms/IndVarSimplify/replace-loop-exit-folds.ll