Landing: 1649ee187dfd

Project / Subsystem

gcc / tree-optimization

Date

2026-07-25

Author

Ashley Chekhova

Commit

1649ee187dfdb89f52e6acf15525465f77b67a64

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
tree-optimization
patch_id
commit_hash
1649ee187dfdb89f52e6acf15525465f77b67a64
source_type
github
headline
tree-optimization: Fix strlen(s) != 0 not folded into *s [PR92408]
tldr
Fixes a bug where strlen(s) != 0 was not being optimized into *s != 0, improving constant folding.
author
Ashley Chekhova
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • tree-optimization
  • strlen
  • constant folding
  • bugfix
discussion_id_link
bugzilla_pr
date
2026-07-25T00:00:00.000Z

A bug in the tree optimization pass that prevented strlen(s) != 0 from being folded into the more efficient check *s != 0 has been fixed. Previously, this optimization was only applied in simple cases and not during complex scenarios involving variable assignments. The fix moves this logic to the forwprop pass, ensuring the optimization is applied more broadly and improving code generation for string checks.