Landing: 22d833315ea8
Project / Subsystem
gcc / match.pd
Date
2026-07-31
Author
Kyrylo Tkachov
Commit
22d833315ea8ed0069be1a5d920532e9771613d2
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- match.pd
- patch_id
- —
- commit_hash
- 22d833315ea8ed0069be1a5d920532e9771613d2
- source_type
- github
- headline
- Optimize product of quotients to a single division.
- tldr
- Replaces two divisions with a multiply and one division, improving performance on targets where division is expensive.
- author
- Kyrylo Tkachov
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • optimization
- • performance
- • floating-point
- • aarch64
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-07-31T00:00:00.000Z
This commit introduces an optimization rule to match.pd that transforms the product of two quotients, (A / B) * (C / D), into a single division: (A * C) / (B * D). This is beneficial on architectures where division is significantly slower than multiplication. The new rule excludes infinities and NaNs and requires non-trapping math to ensure correctness. New test cases are added to gcc.dg/tree-ssa/ to verify this transformation.