[all-commits] [llvm/llvm-project] b3cba9: [LoopVectorize] Vectorize select-cmp reduction pat...

Mel Chen via All-commits all-commits at lists.llvm.org
Thu Dec 12 00:48:52 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b3cba9be41bfa89bc0ec212706c6028a901e127a
      https://github.com/llvm/llvm-project/commit/b3cba9be41bfa89bc0ec212706c6028a901e127a
  Author: Mel Chen <mel.chen at sifive.com>
  Date:   2024-12-12 (Thu, 12 Dec 2024)

  Changed paths:
    M llvm/include/llvm/Analysis/IVDescriptors.h
    M llvm/include/llvm/Transforms/Utils/LoopUtils.h
    M llvm/lib/Analysis/IVDescriptors.cpp
    M llvm/lib/Transforms/Utils/LoopUtils.cpp
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    M llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
    A llvm/test/Transforms/LoopVectorize/iv-select-cmp-blend.ll
    M llvm/test/Transforms/LoopVectorize/iv-select-cmp-no-wrap.ll
    M llvm/test/Transforms/LoopVectorize/iv-select-cmp-trunc.ll
    M llvm/test/Transforms/LoopVectorize/iv-select-cmp.ll
    M llvm/test/Transforms/LoopVectorize/select-min-index.ll

  Log Message:
  -----------
  [LoopVectorize] Vectorize select-cmp reduction pattern for increasing integer induction variable (#67812)

Consider the following loop:
```
  int rdx = init;
  for (int i = 0; i < n; ++i)
    rdx = (a[i] > b[i]) ? i : rdx;
```
We can vectorize this loop if `i` is an increasing induction variable.
The final reduced value will be the maximum of `i` that the condition
`a[i] > b[i]` is satisfied, or the start value `init`.

This patch added new RecurKind enums - IFindLastIV and FFindLastIV.

---------

Co-authored-by: Alexey Bataev <5361294+alexey-bataev at users.noreply.github.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list