Landing: 1df48a01e07e

Project / Subsystem

gcc / match

Date

2026-07-10

Author

Kael Andrew Franco

Commit

1df48a01e07e30592e0119232b1aaf3d41be03f4

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match
patch_id
commit_hash
1df48a01e07e30592e0119232b1aaf3d41be03f4
source_type
github
headline
match: Use tree_expr_nonnegative_p for (X / Y) (==, !=) 0 -> X (<,>=) Y [PR125738]
tldr
Improves optimization by using tree_expr_nonnegative_p for division-related condition simplification.
author
Kael Andrew Franco
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • tree-ssa
  • match.pd
  • unsigned types
discussion_id_link
bugzilla_pr
date
2026-07-10T00:00:00.000Z

This commit enhances GCC’s optimization capabilities by using tree_expr_nonnegative_p in match.pd to correctly simplify expressions involving division. Specifically, it enables the transformation of (X / Y) (==, !=) 0 to X (<,>=) Y when X and Y are known to be non-negative. This change relaxes the conditions for this optimization, addressing issues with unsigned types and ensuring more aggressive and correct simplification of conditional expressions.