Landing: 20897922c9b4

Project / Subsystem

gcc / gcc/loop-optimization

Date

2026-09-02

Author

Richard Biener

Commit

20897922c9b4b63333615ec01d92fcc5a5a771ea

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
gcc/loop-optimization
patch_id
—
commit_hash
20897922c9b4b63333615ec01d92fcc5a5a771ea
source_type
github
headline
Loop invariant code motion honors -fwrapv-pointer
tldr
Loop invariant analysis now correctly considers pointer wrapping behavior when `-fwrapv-pointer` is enabled.
author
Richard Biener
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • loop-optimization
  • • optimization
  • • pointer-arithmetic
discussion_id_link
—
bugzilla_pr
—
date
2026-09-02T00:00:00.000Z

The nowrap_type_p function, used by loop invariant optimization (IVOPTs) and loop iteration analysis, incorrectly assumed pointer types never wrap. This commit updates tree-ssa-loop-niter.cc to properly honor the -fwrapv-pointer flag, ensuring that pointer arithmetic is analyzed with the correct wrapping semantics. Two test cases are added to verify this correction.