llvm / llvm/llvm-project

[InstCombine] Intrinsic::vector_partial_reduce_add constant folding special cases

Open
#224,350 1 comment 0 reactions 1 assignee Assigned to @Chennesxu View on GitHub
llvm:instcombine
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

As discussed here: https://github.com/llvm/llvm-project/pull/212112#pullrequestreview-5238321505

> Noting a couple ideas for follow ups:
> 1. We could handle scalable idioms such as all zeros, splats.
> 2. We could have an instcombine generalization for when Acc isn't a constant, but Vec is to reduce the constant, and replace the partial reduce with a plain add. (Said differently, view a partial.reduce.add(Acc, C) as add(Acc, partial.reduce.add(0, C)) and apply the constant folding idea from here.)
> 3. The prior item would also generalize to various non-constant Vec cases.

Contributor guide

Open the contributing guide

Research direction

Start with the linked pull request and review, then trace the existing InstCombine handling for Intrinsic::vector_partial_reduce_add. Clarify which of the three proposed follow-ups is in scope and how each case should be validated; the work is done when the chosen constant-folding or generalization behavior is implemented and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
compilers
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.