[all-commits] [llvm/llvm-project] 999b3c: [SelectionDAG] Fold VECREDUCE_ADD of a constant BU...

Ankit Kumar Tiwari via All-commits all-commits at lists.llvm.org
Tue Jul 7 07:36:22 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 999b3cfbe21747aa952f79814e7dfd1a7b3fd891
      https://github.com/llvm/llvm-project/commit/999b3cfbe21747aa952f79814e7dfd1a7b3fd891
  Author: Ankit Kumar Tiwari <141545455+ankit-cybertron at users.noreply.github.com>
  Date:   2026-07-07 (Tue, 07 Jul 2026)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/test/CodeGen/RISCV/rvv/fold-binary-reduce.ll
    A llvm/test/CodeGen/RISCV/rvv/vecreduce-add-constant-fold.ll

  Log Message:
  -----------
  [SelectionDAG] Fold VECREDUCE_ADD of a constant BUILD_VECTOR (#207560)

This PR implements constant folding for ISD::VECREDUCE_ADD when the
input is a BUILD_VECTOR of integer constants. The fold computes the sum
at compile time using APInt arithmetic and returns a folded constant
scalar, instead of emitting real vector materialization and reduction
instructions for a value that's already known.

Folding is skipped if any element is undef or opaque, since the result
can't be assumed at compile time in that case.

Fixes #206743



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