Landing: 081959973e38

Project / Subsystem

gcc / gcc

Date

2026-07-10

Author

Roger Sayle

Commit

081959973e38fde06077cbfa70e036e4f018489c

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gcc
patch_id
commit_hash
081959973e38fde06077cbfa70e036e4f018489c
source_type
github
headline
PR tree-optimization/57371: Improved comparison of integers to FP constants.
tldr
Enhances optimization for integer-to-floating-point constant comparisons, considering trapping behavior and rounding.
author
Roger Sayle
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • floating-point
  • integer conversion
  • bugfix
discussion_id_link
github:gcc-mirror/gcc#57371
bugzilla_pr
date
2026-07-10T00:00:00.000Z

This patch refines the tree-level optimization for comparing integers to floating-point constants, addressing PR57371. It now considers the flag_trapping_math to correctly preserve floating-point exception behavior. The core improvement involves determining if a comparison is unambiguous enough to be converted to a safer integer comparison, carefully handling potential rounding issues inherent in floating-point conversions.