[PATCH] D111077: [LV] Support converting FP add to integer reductions.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 20 13:59:38 PST 2021


Ayal added a comment.

> Floating point reductions that start at an integer value and only get
> incremented by another positive integer value can be performed on
> integers

When the (integer) increments are invariant, as in several examples, such reductions should better be identified as (integer) **inductions**, with their final live-out value of `saturate(init_value + trip_count[-1] * invariant_increment)` pre-computed at the pre-header? Their in-loop values could then also be used, more easily (and efficiently) for trip counts known to avoid saturation. The general reduction infrastructure is needed when the increments are variant, as in the select'ing examples.
Why restrict to integer increments that are powers of 2?



================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp:914
   // If the above is false, we have ExactFPMath & do not allow reordering.
   // If the EnableStrictReductions flag is set, first check if we have any
   // Exact FP induction vars, which we cannot vectorize.
----------------
The `EnableStrictReductions`-part of the comment above should be moved below?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111077/new/

https://reviews.llvm.org/D111077



More information about the llvm-commits mailing list