[all-commits] [llvm/llvm-project] 34bea2: [LV] Vectorize down-counting floating-point argmin...

Madhur Amilkanthwar via All-commits all-commits at lists.llvm.org
Wed Jul 15 09:39:59 PDT 2026


  Branch: refs/heads/users/madhur13490/lv-fp-argmin
  Home:   https://github.com/llvm/llvm-project
  Commit: 34bea2fbc00d44ff727e4cfd155b544a4a04c307
      https://github.com/llvm/llvm-project/commit/34bea2fbc00d44ff727e4cfd155b544a4a04c307
  Author: Madhur Amilkanthwar <madhura at nvidia.com>
  Date:   2026-07-15 (Wed, 15 Jul 2026)

  Changed paths:
    M llvm/lib/Analysis/IVDescriptors.cpp
    M llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp
    M llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
    M llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
    A llvm/test/Transforms/LoopVectorize/AArch64/select-index-decreasing.ll

  Log Message:
  -----------
  [LV] Vectorize down-counting floating-point argmin/argmax reductions

Extend the multi-use min/max reduction coupling so a floating-point
min/max value reduction can be paired with a down-counting (FindFirst)
index reduction, enabling argmin/argmax vectorization for loops whose
induction counts down.

Analysis (IVDescriptors):
 - Recognize select-based FP min/max recurrences, not just the
   intrinsic form.
 - For the shared-compare argmin/argmax shape (the reduction compare
   also feeds an index select), take the required NaN-free and
   signed-zero-free facts from the compare when the select itself does
   not carry them. Plain min/max reductions keep the strict
   flags-on-the-select rule.

VPlan (handleMultiUseReductions):
 - Accept a select as the value reduction's min/max operation and read
   its value operands accordingly.
 - Tolerate the shared compare feeding both the value select and the
   index select, skipping the value select when locating the index
   select.
 - Support the down-counting FindFirst index reduction (UMin/SMin) for
   floating-point, reconstructing the stored index from the base
   induction plus an additive offset (e.g. iv-1).
 - Fall back to scalar safely for shapes that are not handled.

Scope is intentionally limited to keep the change small:
 - TODO: floating-point up-counting (FindLast) argmin/argmax.
 - TODO: integer down-counting (FindFirst) argmin/argmax.

Add lit tests covering the down-counting floating-point argmin,
including the VF=1 scalar-plan path.



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