Landing: 582adc3c97b1
Project / Subsystem
gcc / cselib
Date
2026-05-20
Author
Richard Sandiford
Commit
582adc3c97b1e0c42243b106384eb66b7618a682
Source
github
Perf win
Yes
Breaking
No
All attributes
- project
- gcc
- subsystem
- cselib
- patch_id
- —
- commit_hash
- 582adc3c97b1e0c42243b106384eb66b7618a682
- source_type
- github
- headline
- cselib: Optimize Value Invalidation by Avoiding Repeated discard_useless_locs
- tldr
- This commit optimizes value invalidation in `cselib` by avoiding the repeated discarding of useless locations, improving compile time, especially with RTL chec…
- author
- Richard Sandiford
- outcome
- committed
- performance_win
- true
- breaking_change
- false
- series_id
- —
- series_parts
- []
- tags
-
- • cselib
- • optimization
- • compile-time
- • rtl
- discussion_id_link
- —
- bugzilla_pr
- —
- date
- 2026-05-20T00:00:00.000Z
The code was spending significant time repeatedly calling discard_useless_locs in cselib, especially when RTL checking was enabled. To address this, the commit adds a flag to cselib_val to indicate whether every location only references preserved values. It then maintains a list of entries that might have useless locations, allowing remove_useless_values to iterate over this list instead of the entire hash table. This optimization reduces compile time in scenarios with many blocks and entries in cselib_preserved_hash_table.