[all-commits] [llvm/llvm-project] 22f860: [LV] Bundle (partial) reductions with a mul of a c...

Sam Tebbs via All-commits all-commits at lists.llvm.org
Tue Oct 28 10:00:15 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 22f860a55d193d98e42cf19fac57539cdb0ab124
      https://github.com/llvm/llvm-project/commit/22f860a55d193d98e42cf19fac57539cdb0ab124
  Author: Sam Tebbs <samuel.tebbs at arm.com>
  Date:   2025-10-28 (Tue, 28 Oct 2025)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
    M llvm/test/Transforms/LoopVectorize/reduction-inloop.ll
    M llvm/test/Transforms/LoopVectorize/vplan-printing-reductions.ll

  Log Message:
  -----------
  [LV] Bundle (partial) reductions with a mul of a constant (#162503)

A reduction (including partial reductions) with a multiply of a constant
value can be bundled by first converting it from `reduce.add(mul(ext,
const))` to `reduce.add(mul(ext, ext(const)))` as long as it is safe to
extend the constant.

This PR adds such bundling by first truncating the constant to the
source type of the other extend, then extending it to the destination
type of the extend. The first truncate is necessary so that the types of
each extend's operand are then the same, and the call to
canConstantBeExtended proves that the extend following a truncate is
safe to do. The truncate is removed by optimisations.

This is a stacked PR, 1a and 1b can be merged in any order:
1a. https://github.com/llvm/llvm-project/pull/147302
1b. https://github.com/llvm/llvm-project/pull/163175
2. -> https://github.com/llvm/llvm-project/pull/162503



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