Landing: 7b8104e346cf

Project / Subsystem

gcc / tree-ssa

Date

2026-09-05

Author

Kyrylo Tkachov

Commit

7b8104e346cf3949b0ca6eab93106ac860fb3306

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
tree-ssa
patch_id
—
commit_hash
7b8104e346cf3949b0ca6eab93106ac860fb3306
source_type
github
headline
tree-ssa: Canonicalize arithmetic overflow IFN operands
tldr
Canonicalizes operands for arithmetic overflow internal functions to improve consistency.
author
Kyrylo Tkachov
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • compiler-internals
discussion_id_link
—
bugzilla_pr
—
date
2026-09-05T00:00:00.000Z

This change canonicalizes the operands of commutative arithmetic overflow internal functions, such as ADD_OVERFLOW. Previously, the order of operands could be non-canonical, potentially disagreeing with related addition operations. By using tree_swap_operands_p, the operands are now ordered consistently, improving the predictability of optimization passes and reducing potential discrepancies in generated code. This also applies to MUL_OVERFLOW, while SUB_OVERFLOW retains its original order as it is not commutative. A new test case for aarch64 verifies this behavior.