Landing: 685f665a6c81

Project / Subsystem

gcc / gcc

Date

2026-04-28

Author

Raghesh Aloor

Commit

685f665a6c811ae0e5603bdd48f8dd6e527a1490

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gcc
patch_id
commit_hash
685f665a6c811ae0e5603bdd48f8dd6e527a1490
source_type
github
headline
BB SLP: Enabling reduction root finding for sum-of-diff kind of patterns
tldr
This commit enables vectorization of "sum of diffs" patterns by allowing the SLP vectorizer to recognize chains involving both PLUS and MINUS expressions.
author
Raghesh Aloor
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • gcc
  • vectorization
  • SLP
  • optimization
discussion_id_link
bugzilla_pr
date
2026-04-28T00:00:00.000Z

This commit enhances the SLP (Straight-Line Program) vectorizer to recognize and vectorize “sum of diffs” patterns, where the sum of differences between elements of two arrays is calculated. It introduces an optional parameter to vect_slp_linearize_chain to control whether MINUS_EXPR nodes are followed during reduction root finding. By default, MINUS_EXPR nodes are treated as leaves, enabling the vectorization of the “sum of diffs” pattern. A new test case is added to verify the functionality.