[LSR] Filter for postinc formulae
authorDavid Green <david.green@arm.com>
Fri, 29 May 2020 09:53:30 +0000 (10:53 +0100)
committerDavid Green <david.green@arm.com>
Wed, 17 Jun 2020 11:32:04 +0000 (12:32 +0100)
commit076e08aa4501f682c43e71a8fed1e12da485abc7
tree03d5b437dd16dcfc2c9a6ffb37fba0399f4a0741
parent88c8581d9fe449f07781ff8abedf598b9410e727
[LSR] Filter for postinc formulae

In more complicated loops we can easily hit the complexity limits of
loop strength reduction. If we do and filtering occurs, it's all too
easy to remove the wrong formulae for post-inc preferring accesses due
to it attempting to maximise register re-use. The patch adds an
alternative filtering step when the target is preferring postinc to pick
postinc formulae instead, hopefully lowering the complexity to below the
limit so that aggressive filtering is not needed.

There is also a change in here to stop considering existing addrecs as
free under postinc. We should already be modelling them as a reg so
don't want it to cause us to get the cost wrong. (I'm not sure that code
makes sense in general, but there are X86 tests specifically for it
where it seems to be helping so have left it around for the standard
non-post-inc case).

Differential Revision: https://reviews.llvm.org/D80273
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/test/CodeGen/Thumb2/mve-float16regloops.ll
llvm/test/CodeGen/Thumb2/mve-float32regloops.ll