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

cselib: Cache CSELIB_VAL_PTR in new_elt_loc_list

This commit caches `CSELIB_VAL_PTR` in `new_elt_loc_list` for improved readability and minor optimization.

The code in new_elt_loc_list was accessing one value directly and another indirectly using CSELIB_VAL_PTR. This commit caches the result of CSELIB_VAL_PTR so all updates are done on direct cselib_val pointers, improving code readability. This change also provides a minor optimization, especially when RTL checking is enabled.

In Details

This commit introduces a minor optimization and improves code clarity in cselib.cc, specifically in the new_elt_loc_list function. By caching the result of CSELIB_VAL_PTR, the code consistently uses direct cselib_val pointers, making it easier to understand. This also results in a small performance improvement, particularly when RTL checking is enabled due to reduced indirection.

For Context

cselib is about optimizing code. This commit makes a small change to the internal workings of cselib to improve readability and performance. By caching a pointer, the code avoids repeated lookups, resulting in slightly faster execution. This type of change is primarily for developers working on the compiler itself.

Filed Under: cseliboptimizationreadability