[LSR] Improve filtered uses in NarrowSearchSpaceByPickingWinnerRegs
authorDavid Green <david.green@arm.com>
Thu, 16 Feb 2023 15:48:12 +0000 (15:48 +0000)
committerDavid Green <david.green@arm.com>
Thu, 16 Feb 2023 15:48:12 +0000 (15:48 +0000)
commit7abe3497e72af3ddee789dfc62c63a981a25dbf6
tree5da79ce120286c555fcb8bdb990d72ac8610a9f7
parenta768112e0641e48d26b60761bef28849c065d54e
[LSR] Improve filtered uses in NarrowSearchSpaceByPickingWinnerRegs

NarrowSearchSpaceByPickingWinnerRegs has an aggressive filtering method to
reduce the complexity of the search space down by picking a best formula with
the highest number of reuses and assuming it will yield profitable reuse. In
certain cases we can find a best formula like {X+30,+,1} and later check a
formula like {X,+,1} with the same number of Uses. On some architectures it
can be better to pick {X,+,1}, especially if an offset of 30 can be used as a
legal addressing mode, but -30 cannot. That happens under Thumb1 code, which
has fairly limited addressing modes. This patch adds a check to see if it can
pick the simpler formula, if it looks more profitable.

Differential Revision: https://reviews.llvm.org/D144014
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/test/CodeGen/Thumb/arm_q15_to_q31.ll