Landing: 79c77e164203
Project / Subsystem
gcc / gcc/match.pd
Date
2026-07-06
Author
Pengfei Li
Commit
79c77e1642030361a17b3c892a00092d8285a3b2
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- gcc/match.pd
- patch_id
- —
- commit_hash
- 79c77e1642030361a17b3c892a00092d8285a3b2
- source_type
- github
- headline
- match.pd: Fold SAD_EXPR with identical inputs to simplify reduction loops
- tldr
- Optimizes vector reduction loops by folding redundant absolute difference calculations.
- author
- Pengfei Li
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • pattern matching
- • vectorization
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-06T00:00:00.000Z
This commit adds a new pattern to match.pd that folds SAD_EXPR (Sum of Absolute Differences) operations where the first two operands are identical. Such cases, which evaluate to zero, can arise in vectorization of small reduction loops. By folding SAD(x, x, acc) into just acc, the compiler avoids unnecessary calculations, potentially improving the efficiency of vectorized reduction operations.