[all-commits] [llvm/llvm-project] ba40a7: [LoopVectorize] Vectorize fixed-order recurrence w...

Mel Chen via All-commits all-commits at lists.llvm.org
Wed Jun 18 01:03:41 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ba40a7bc2e65be86ac23c9cf6038ac085dda77eb
      https://github.com/llvm/llvm-project/commit/ba40a7bc2e65be86ac23c9cf6038ac085dda77eb
  Author: Mel Chen <mel.chen at sifive.com>
  Date:   2025-06-18 (Wed, 18 Jun 2025)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
    M llvm/test/Transforms/LoopVectorize/RISCV/first-order-recurrence-scalable-vf1.ll
    M llvm/test/Transforms/LoopVectorize/first-order-recurrence-scalable-vf1.ll

  Log Message:
  -----------
  [LoopVectorize] Vectorize fixed-order recurrence with vscale x 1. (#142772)

When the fixed-order recurrence phi is live-out from the loop, the
vectorizer uses VPInstruction::ExtractPenultimateElement to extract the
penultimate element from the recurrence vector. However, this is not
feasible when the VF is vscale x 1, since vscale could be 1, making the
vector contain only one element.

This patch changes the behavior for vscale x 1 by extracting the last
element from the vector produced by splicing the recurrence phi and the
previous value. This ensures we can still determine the correct live-out
value of the recurrence phi.



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