Landing: c5d24759ba5e

Project / Subsystem

gcc / tree-optimization

Date

2026-08-24

Author

Richard Biener

Commit

c5d24759ba5e470f6fb75e251b84ec8fcb33db07

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
tree-optimization
patch_id
—
commit_hash
c5d24759ba5e470f6fb75e251b84ec8fcb33db07
source_type
github
headline
Revise (T *)(ptr - ptr_cst) pattern
tldr
Canonicalizes pointer arithmetic patterns for better optimization.
author
Richard Biener
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • pointer arithmetic
  • • tree-optimization
discussion_id_link
—
bugzilla_pr
—
date
2026-08-24T00:00:00.000Z

This commit refines a GCC pattern for pointer arithmetic involving type casting. The pattern (T *)(ptr - ptr_cst) is now directly canonicalized to (T *)ptr p+ cst. This change simplifies the GENERIC representation, allowing subsequent optimizations to more effectively recognize and process pointer arithmetic. The pattern was originally introduced to avoid issues with build_fold_addr_expr_with_type, and this revision ensures more robust simplification.