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

Matthew Devereau via All-commits all-commits at lists.llvm.org
Mon Jan 30 01:42:28 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ff47f6032cbfd49f8fe22d46a48eb602b224661
      https://github.com/llvm/llvm-project/commit/8ff47f6032cbfd49f8fe22d46a48eb602b224661
  Author: Matt Devereau <matthew.devereau at arm.com>
  Date:   2023-01-30 (Mon, 30 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;
}

This would previously fail to vectorize due to the integer reduction.




More information about the All-commits mailing list