https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125334

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <[email protected]>:

https://gcc.gnu.org/g:b66fd30e4b3943460a6cc030491043502bd3b65d

commit r17-1384-gb66fd30e4b3943460a6cc030491043502bd3b65d
Author: Patrick Palka <[email protected]>
Date:   Fri Jun 5 17:05:26 2026 -0400

    c++/modules: some dependent ADL fixes

    When looking at the stream-in performance regression PR c++/125334
    (caused by the dependent ADL patch r16-6311) I spotted some issues with
    add_dependent_adl_entities:

      1. Fix memory leak in add_dependent_adl_entities when it exits early.
      2. Only consider type-dependent calls/operator expressions.
      3. Fix early exit test for when all args are type-dependent.
      4. Add assert verifying recursive name lookup does not happen with
         tentative/dependent ADL since it avoids type completion.

    Plugging the memory leak reduces max memory usage by 3% when building
    the std module, besides that no significant effect towards the
    regression.

    gcc/cp/ChangeLog:

            * module.cc (dep_adl_info::args): Initializer to nullptr
            instead of immediately allocating.
            (depset::hash::add_dependent_adl_entities): Exit early
            for non-type-dependent calls and operator expressions.
            Only allocate dep_adl_info::args if we're not exiting early.
            Correct all-type-dependent args test.
            * name-lookup.cc (name_lookup::preserve_state): Replace
            propagation of tentative flag with assert that it's not
            set.

    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to