[all-commits] [llvm/llvm-project] 1af3f5: [DAG] Fold Op(vecreduce(a), vecreduce(b)) into vec...

David Green via All-commits all-commits at lists.llvm.org
Wed Feb 8 03:43:50 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1af3f596f6c6b213cec9b3acd7099f8c4f11d0d0
      https://github.com/llvm/llvm-project/commit/1af3f596f6c6b213cec9b3acd7099f8c4f11d0d0
  Author: David Green <david.green at arm.com>
  Date:   2023-02-08 (Wed, 08 Feb 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/TargetLowering.h
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/Target/ARM/ARMISelLowering.h
    M llvm/test/CodeGen/AArch64/aarch64-addv.ll
    M llvm/test/CodeGen/AArch64/double_reduct.ll
    M llvm/test/CodeGen/AArch64/sve-doublereduct.ll
    M llvm/test/CodeGen/AArch64/sve-fp-reduce.ll
    M llvm/test/CodeGen/AArch64/vecreduce-add.ll
    M llvm/test/CodeGen/AArch64/vecreduce-fadd.ll
    M llvm/test/CodeGen/RISCV/double_reduct.ll
    M llvm/test/CodeGen/Thumb2/mve-doublereduct.ll

  Log Message:
  -----------
  [DAG] Fold Op(vecreduce(a), vecreduce(b)) into vecreduce(Op(a,b))

So long as the operation is reassociative, we can reassociate the double
vecreduce from for example fadd(vecreduce(a), vecreduce(b)) to
vecreduce(fadd(a,b)). This will in general save a few instructions, but some
architectures (MVE) require the opposite fold, so a shouldExpandReduction is
added to account for it. Only targets that use shouldExpandReduction will be
affected.

Differential Revision: https://reviews.llvm.org/D141870




More information about the All-commits mailing list