Re: [PATCH] RISC-V: Return implied_exts by const refer ence
"Jin Ma" <[email protected]> Tue, 04 Aug 2026 14:43:56 +0800
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
> 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). Hi Jeff, I did omit the testing information from the original email. Sorry. The patch passed my local CI with no new failures. Since this change affects a common code path exercised by most tests, I do not think an additional test case is necessary. OK for trunk? Thanks, Jin