[all-commits] [llvm/llvm-project] f90103: [LoopVectorize] Enable integer Mul and Add as sele...

Matthew Devereau via All-commits all-commits at lists.llvm.org
Wed Jan 25 05:25:36 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f90103851f9a381bbf7ed6da250217577afd00d2
      https://github.com/llvm/llvm-project/commit/f90103851f9a381bbf7ed6da250217577afd00d2
  Author: Matt Devereau <matthew.devereau at arm.com>
  Date:   2023-01-25 (Wed, 25 Jan 2023)

  Changed paths:
    M llvm/lib/Analysis/IVDescriptors.cpp
    M llvm/test/Transforms/LoopVectorize/if-reduction.ll

  Log Message:
  -----------
  [LoopVectorize] Enable integer Mul and Add as select reduction patterns

This patch vectorizes Phi node loop reductions for select's whos condition
comes from a floating-point comparison, with its operands being integers
for Add, Sub, and Mul reductions.

Example:

int foo(float *x, int n) {
    int sum = 0;
    for (int i=0; i<n; ++i) {
        float elem = x[i];
        if (elem > 0) {
            sum += 2;
        }
    }
    return sum;
}

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




More information about the All-commits mailing list