[LoopVectorize] Add FastMathFlags to the select used for reductions with tail-folding
authorDavid Sherwood <david.sherwood@arm.com>
Wed, 1 Jun 2022 13:01:37 +0000 (14:01 +0100)
committerDavid Sherwood <david.sherwood@arm.com>
Tue, 7 Jun 2022 09:21:31 +0000 (10:21 +0100)
commit997ecb0036a56df1fe77fafb69393255aa995de2
tree0279cc5b076819e29a489f64b082a5ff522d78a1
parent8324561e33b44804fe44215a28a2f64c15717dc0
[LoopVectorize] Add FastMathFlags to the select used for reductions with tail-folding

Based on reviewer comments on https://reviews.llvm.org/D126692 I've
added FastMathFlags to the select instruction used when tail-folding
with reductions. These flags can then be used by InstCombine to
decide upon the most optimal floating point identity value for
fadd/fsub. Doing so unlocks further optimisations, such as folding
selects into masked loads.

Differential Revision: https://reviews.llvm.org/D126778
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/ARM/mve-reduction-predselect.ll
llvm/test/Transforms/LoopVectorize/ARM/mve-reduction-types.ll
llvm/test/Transforms/LoopVectorize/reduction-predselect.ll