https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123145
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by David Malcolm <[email protected]>: https://gcc.gnu.org/g:c28dd8467b1e35219b8d74c5ff96c43d49eb9612 commit r16-7053-gc28dd8467b1e35219b8d74c5ff96c43d49eb9612 Author: David Malcolm <[email protected]> Date: Mon Jan 26 18:57:51 2026 -0500 analyzer: avoid calling binding_map::const_iterator::operator* [PR123145] PR analyzer/123145 tracks a large slowdown seen in -fanalyzer on a particular test case in qemu. Profiling showed a large amount of time being spent iterating through binding maps with binding_map::const_iterator::operator*, due to the work spent converting from bit_range to concrete_key via store_manager::get_concrete_binding. Many of the iterations where this done are merely looking at the bound svalues, not the keys, so this work is wasted. This patch updates these iterations to avoid needing to do work on the keys. Crude benchmarking (on a debug, not release build) showed a speedup on the test case, from 3 hours to 2.2 hours. No functional change intended. gcc/analyzer/ChangeLog: PR analyzer/123145 * program-state.cc (sm_state_map::impl_set_state): Update iteration to avoid looking up binding_key values. * region-model-reachability.cc (reachable_regions::handle_sval): Use iter.get_svalue. (reachable_regions::handle_parm): Likewise. * region-model.cc (iterable_cluster::iterable_cluster): Update iteration to avoid looking up binding_key values. (iterable_cluster::dump_to_pp): Likewise. (exposure_through_uninit_copy::calc_num_uninit_bits): Likewise. (exposure_through_uninit_copy::complain_about_uninit_ranges): Likewise. (contains_uninit_p): Likewise. * store.cc (binding_map::hash): Likewise. * store.h (bit_range::hash): New, based on... (concrete_binding::hash): ...this. Reimplement using the above. (binding_map::const_iterator::get_svalue): New decl. (binding_map::get_symbolic_bindings): New accessor. (binding_map::for_each_value): Update iteration to avoid looking up binding_key values. Signed-off-by: David Malcolm <[email protected]>
