GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
cselib Performance Win

cselib: Simplify references_value_p

The function `references_value_p` in cselib is simplified by removing an unused parameter and converting it to use iterators, potentially improving compile tim…

The references_value_p function in cselib was simplified by removing the only_useless parameter, which is no longer needed. The function was also converted to use RTX iterators. While performance numbers aren’t available for this specific change, similar iterator conversions have previously shown significant compile-time improvements, particularly in the context of insn-extract.cc.

In Details

The commit simplifies references_value_p in cselib.cc by removing the only_useless parameter and converting the function to use RTX iterators. references_value_p is used to check if an RTX references a specific value. The change may improve compile time, especially when RTL checking is enabled, by making the function more efficient. The function's callers in invariant_or_equiv_p, reload_cse_simplify_set, and reverse_op are updated accordingly.

For Context

cselib (CSE library) is a GCC component that helps with common subexpression elimination (CSE), a compiler optimization technique. references_value_p likely checks whether a given representation of an operation (rtx) refers to a particular value. This commit simplifies this function by removing an unnecessary parameter and using iterators to improve efficiency. Iterators are a way to access elements in a data structure, like a list, one after another, which can be faster than other methods.

Filed Under: cseliboptimizationrefactorcompile-time