[all-commits] [llvm/llvm-project] 5db7e5: [SLP]Keep ordered fadd reductions sequential

Alexey Bataev via All-commits all-commits at lists.llvm.org
Sat Jun 13 19:18:10 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5db7e5b483a32f37d1d77a6f18d2bc4c59fa460a
      https://github.com/llvm/llvm-project/commit/5db7e5b483a32f37d1d77a6f18d2bc4c59fa460a
  Author: Alexey Bataev <a.bataev at outlook.com>
  Date:   2026-06-13 (Sat, 13 Jun 2026)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    M llvm/test/Transforms/SLPVectorizer/X86/ordered-reduction-replaced.ll
    M llvm/test/Transforms/SLPVectorizer/X86/ordered-reduction-root-deleted.ll
    M llvm/test/Transforms/SLPVectorizer/X86/reduction-ordered-fadd.ll

  Log Message:
  -----------
  [SLP]Keep ordered fadd reductions sequential

tryToReduceOrdered vectorizes reductions that are not associative (e.g. an
fadd with reassoc but without nsz). The accumulation order must be
preserved, but the reduction was costed and emitted with reassoc, and the
whole tree was rotated to memory order by reorderTopToBottom, which can
change the result of the sequential reduction.

Drop reassoc from the flags used to cost and emit the reduction so the
generated llvm.vector.reduce.fadd stays ordered, and drop the top-to-bottom
reorder so the reduced values keep their original accumulation order.

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/203741



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