Landing: 36990bb0d14c

Project / Subsystem

gcc / gcc/tree-optimization

Date

2026-08-05

Author

Naveen

Commit

36990bb0d14c4840d0250f000559d7a2a569fbc9

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gcc/tree-optimization
patch_id
—
commit_hash
36990bb0d14c4840d0250f000559d7a2a569fbc9
source_type
github
headline
Recognize add/sub absolute-value idiom
tldr
GCC now optimizes Y + abs(X) and Y - abs(X) expressions to improve code efficiency.
author
Naveen
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • gcc
  • • optimization
  • • idiom
discussion_id_link
—
bugzilla_pr
—
date
2026-08-05T00:00:00.000Z

GCC’s tree optimizer now recognizes and simplifies expressions involving addition or subtraction of an absolute value. The transformation is applied to signed integral types by performing the operation in the unsigned domain, preserving wrapping semantics and avoiding signed overflow. This optimization is not applied if signed overflow traps or is sanitized.