[all-commits] [llvm/llvm-project] 7dad8b: [flang] Fetch the initial reduction value from the...

Slava Zakharin via All-commits all-commits at lists.llvm.org
Wed Apr 30 13:53:47 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7dad8b91bc94741034052a4eb06ef45e7cb47c06
      https://github.com/llvm/llvm-project/commit/7dad8b91bc94741034052a4eb06ef45e7cb47c06
  Author: Slava Zakharin <szakharin at nvidia.com>
  Date:   2025-04-30 (Wed, 30 Apr 2025)

  Changed paths:
    M flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp
    M flang/test/HLFIR/simplify-hlfir-intrinsics-maxloc.fir
    M flang/test/HLFIR/simplify-hlfir-intrinsics-maxval.fir
    M flang/test/HLFIR/simplify-hlfir-intrinsics-minloc.fir
    M flang/test/HLFIR/simplify-hlfir-intrinsics-minval.fir

  Log Message:
  -----------
  [flang] Fetch the initial reduction value from the input array. (#136790)

Instead of using loop-carried IsFirst predicate, we can fetch
the initial reduction values for MIN/MAX LOC/VAL reductions
from the array itself. This results in a little bit cleaner
loop nests, especially, generated for total reductions.
Otherwise, LLVM is able to peel the first iteration of the innermost
loop, but the surroudings of the peeled code are executed
multiple times withing the outer loop(s).

This patch does the manual peeling, which only works for
non-masked reductions where the input array is not empty.



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