[all-commits] [llvm/llvm-project] b0f904: [LV] Account for minimum vscale when rejecting sca...

Philip Reames via All-commits all-commits at lists.llvm.org
Fri Dec 9 11:29:58 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b0f904b6da044ea65d344bc07fc56234adbc6268
  Author: Philip Reames <preames at rivosinc.com>
  Date:   2022-12-09 (Fri, 09 Dec 2022)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Transforms/LoopVectorize/RISCV/short-trip-count.ll

  Log Message:
  [LV] Account for minimum vscale when rejecting scalable vectorization of short loops

The vectorizer has code to reject scalable vectorization of loops with very short trip counts, and instead use fixed length vectors. The current code doesn't account for the minimum vscale value known, and thus under estimates the number of lanes in the scalable type for RISCV's default configuration. This results in use of predication and a trivially dead loop where a single straight line piece of code would suffice.

Note that the code quality of the original scalable vectorization could (and probably should) be improved other ways as well. This patch is solely about whether the scalable vectorization was the right choice to begin with.

This bit of code - both with and without my change - does make the unchecked assumption that the target knows how to lower fixed length vectors whose length is provably less than the vector length.

Differential Revision: https://reviews.llvm.org/D137285

More information about the All-commits mailing list