[PATCH] D153697: [LV] Freeze start value for select-reductions.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 04:19:37 PDT 2023


Ayal added a comment.

> When creating select-reductions, we are introducing multiple new uses of
> the reduction start value. If the start value may be undef or poison,
> then differnet uses (e.g in the final select or vector compares) can
> evaluate to different values, leading to incorrect results.

These `SelectCmp` reductions are essentially boolean `Any` reductions which should use the original reduction start value **only once** - at the reduction epilog, as described in https://reviews.llvm.org/D150851#4440545?
They should also use their alternative value only once, as in `result = (cond(i) for any i) ? startValue : alternativeValue`.
This would also reduce the size of the vectorized/unrolled "accumulator" maintained within the loop, to a minimum.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153697



More information about the llvm-commits mailing list