Landing: b0a84b610038

Project / Subsystem

gcc / tree-optimization

Date

2026-06-04

Author

Zhou Xuhang

Commit

b0a84b6100389c5b24658743252a7ff259ba0816

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
tree-optimization
patch_id
commit_hash
b0a84b6100389c5b24658743252a7ff259ba0816
source_type
github
headline
tree-optimization: Recognize widened unsigned multiply overflow checks
tldr
GCC now recognizes and optimizes widened unsigned multiply overflow checks, canonicalizing them to a specific overflow detection pattern.
author
Zhou Xuhang
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • tree-optimization
  • arithmetic
discussion_id_link
bugzilla_pr
date
2026-06-04T00:00:00.000Z

GCC’s tree optimization pass can now recognize and optimize overflow checks involving widened unsigned multiplications. The compiler canonicalizes patterns where a multiplication result is shifted and compared against the maximum value of the narrow type into a widened comparison form. This form is then further simplified to IFN_MUL_OVERFLOW when the target architecture supports direct unsigned multiply-overflow instructions, enabling more efficient code generation.