Landing: c74d6b12af61

Project / Subsystem

gcc / match.pd

Date

2026-07-29

Author

Kyrylo Tkachov

Commit

c74d6b12af610318980f76b016ace6b4a28ecbcd

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match.pd
patch_id
—
commit_hash
c74d6b12af610318980f76b016ace6b4a28ecbcd
source_type
github
headline
match.pd: Combine pairs of vector reductions into single operations.
tldr
Optimizes vector reductions by combining two separate reductions into a single elementwise operation.
author
Kyrylo Tkachov
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • vectorization
  • • arm
discussion_id_link
—
bugzilla_pr
—
date
2026-07-29T00:00:00.000Z

This optimization in match.pd combines two vector reductions that feed into the same scalar operation into a single reduction of an elementwise operation. This transformation, REDUC(a) op REDUC(b) -> REDUC(a op b), trades a potentially expensive lane-crossing reduction for a cheaper elementwise operation, significantly reducing instruction count for operations like MIN, MAX, AND, IOR, XOR, and floating-point sums.