On 7/22/2026 5:50 AM, Jin Ma wrote:
riscv_ext_info_t::implied_exts() returns its std::vector member by
value, but all three callers (check_implied_ext, handle_combine_ext,
riscv_minimal_hwprobe_feature_bits) only iterate over the result and
never need ownership. Every invocation therefore copies the entire
implied-extension vector. During option parsing this runs once per
compiled source file; at -O0 the optimisation passes are skipped so
option-parsing overhead dominates, causing a 6.7% compile-time
regression on CSIBE -O0 benchmarks.
Return a const reference instead. The underlying m_implied_exts
member lives in a static global map entry and outlives every caller,
so no dangling-reference risk exists.
gcc/ChangeLog:
* common/config/riscv/riscv-common.cc
(riscv_ext_info_t::implied_exts): Return const reference
instead of by-value copy.
This is OK assuming it has gone through the usual testing (no testing
was mentioned).
Jeff