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

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

https://gcc.gnu.org/g:7ce404d9c953b0a1b51e1501ca7332b037170481

commit r17-6277-g7ce404d9c953b0a1b51e1501ca7332b037170481
Author: Jan Hubicka <[email protected]>
Date:   Sat Nov 14 19:01:33 2026 +0100

    Add support for unknown offset accesses in ipa-predicates.

    This patch extends ipa_predicates to handle situation where a conditional
    involved aggregate parameter with unknown offset and the parameter points
    to STRING_CST.  In this case we can inspect string for stuff the function
    look for.  In cppcheck this is, for example, special character '%' which
    is not passed on caller site.

    This is just bare bones of the support.  We need to handle PHIs and jump
    functions which is done incrementally.

    Testcases are by Google Carbon.

    Bootstrapped/regtested x86_64-linux.

    gcc/ChangeLog:

            PR ipa/127171
            * ipa-fnsummary.cc (struct string_char_set_hashmap_traits): New.
            (get_string_char_set): New function.
            (char_set_any_in_range_p): New function.
            (fold_string_char_compare): New function.
            (evaluate_unknown_offset_condition): Evaluate unknown offsets.
            (evaluate_conditions_for_known_args): Handle unknown_offset.
            (unmodified_parm_or_parm_agg_item): Compute unknown_offset.
            (set_cond_stmt_execution_predicate):  Update.
            (will_be_nonconstant_predicate): Update.
            (inline_read_section): Update.
            (ipa_fn_summary_write): Stream uknonwn_offset.
            (ipa_fnsummary_cc_finalize): Stream uknonwn_offset.
            * ipa-fnsummary.h (struct agg_position_info): Add unknown_offset.
            * ipa-predicate.cc (ipa_predicate::add_clause): Handle
unknown_offset.
            (ipa_predicate::probability): Handle unknown_offset conservatively.
            (dump_condition): Dump unkonwn_offset.
            (ipa_predicate::remap_after_inlining): Update unknown_offset.
            (add_condition): Handle unkonwn_offset.
            * ipa-predicate.h (struct condition): Add unknown_offset.
            * ipa-prop.cc (ipa_load_from_parm_agg_unknown_offset): New
function.
            (parm_ref_data_pass_through_p): Use it.
            (ipa_load_from_parm_agg): Handle unknown_offset.
            * ipa-prop.h (ipa_load_from_parm_agg): Likewise.

    gcc/testsuite/ChangeLog:

            * gcc.dg/ipa/fnsummary-10.c: New test.
            * gcc.dg/ipa/fnsummary-7.c: New test.
            * gcc.dg/ipa/fnsummary-8.c: New test.
            * gcc.dg/ipa/fnsummary-9.c: New test.
            Assisted by Gemini Carbon

Reply via email to