Landing: aaa0f6b1e87b

Project / Subsystem

gcc / match.pd

Date

2026-08-24

Author

Kyrylo Tkachov

Commit

aaa0f6b1e87bc62ea15da6eab431af6dcebf6414

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match.pd
patch_id
—
commit_hash
aaa0f6b1e87bc62ea15da6eab431af6dcebf6414
source_type
github
headline
Fold reductions of vector duplicates and repeats [PR127039]
tldr
Optimizes vector reductions by folding idempotent operations on duplicate vectors.
author
Kyrylo Tkachov
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • vectorization
  • • arm
  • • sve
  • • pr127039
discussion_id_link
github:gcc-mirror/gcc#127039
bugzilla_pr
—
date
2026-08-24T00:00:00.000Z

This commit enables GCC to fold vector reductions like REDUC_MAX, REDUC_MIN, REDUC_AND, and REDUC_IOR when applied to duplicate vectors. For example, a REDUC_MAX of a vector [x, x, x] now simplifies to x. It also handles XOR reductions on duplicate vectors, folding them to zero if the lane count is provably even, and correctly processes scalable vectors.