[PATCH] D113973: [LoopVectorize][CostModel] Choose smaller VFs for in-loop reductions with no loads/stores

Rosie Sumpter via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 03:09:13 PST 2021


RosieSumpter added a comment.

As @fhahn pointed out, using the smallest legal integer type for the default max width negatively impacts performance if the smallest type used in the loop is smaller than the smallest legal integer type. Instead, this update iterates through the recurrences in the loop and sets the maximum width to be that of the smallest type used by the recurrences when `ElementTypesInLoop` is empty. To determine the smallest type used by recurrences, we need to check for any casts on the recurrences’ input operands, which are now found by `collectCastInstrs`. This means that the max VF isn’t restricted too much in cases where in-loop reductions use types with width smaller than the target's smallest legal int.


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

https://reviews.llvm.org/D113973



More information about the llvm-commits mailing list