[all-commits] [llvm/llvm-project] 1869a9: [LV] Use the known trip count when costing non-tai...

David Green via All-commits all-commits at lists.llvm.org
Mon Apr 24 14:02:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1869a9c225c7ed411a15592d21b277716b65a374
      https://github.com/llvm/llvm-project/commit/1869a9c225c7ed411a15592d21b277716b65a374
  Author: David Green <david.green at arm.com>
  Date:   2023-04-24 (Mon, 24 Apr 2023)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Transforms/LoopVectorize/AArch64/smallest-and-widest-types.ll
    M llvm/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll

  Log Message:
  -----------
  [LV] Use the known trip count when costing non-tail folded VFs

Now that we store the ScalarCost in the VectorizationFactor it is possible to
use it to get a slightly more accurate cost in isMoreProfitable between two
vector factors. This extends the logic added in D101726 to non-tail-folded
cases, using the costs of `VecCost * (TripCount / VF) + ScalarCost * (TripCount % VF)`
to compare VFs where the TripCount is known and we are not folding the tail.

This shouldn't alter very much as small trip counts are usually not vectorized,
but does seem to help in the testcase where 4 * VF4 is chosen as profitable
compared to 2 * VF8 + 4 * scalar.

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




More information about the All-commits mailing list