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

--- Comment #37 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Jambor <jamb...@gcc.gnu.org>:

https://gcc.gnu.org/g:6d07e3de7e8d39ac144ba1d83bba08d48bacae13

commit r15-7456-g6d07e3de7e8d39ac144ba1d83bba08d48bacae13
Author: Martin Jambor <mjam...@suse.cz>
Date:   Mon Feb 10 16:49:59 2025 +0100

    ipa-cp: Perform operations in the appropriate types (PR 118097)

    One of the testcases from PR 118097 and the one from PR 118535 show
    that the fix to PR 118138 was incomplete.  We must not only make sure
    that (intermediate) results of operations performed by IPA-CP are
    fold_converted to the type of the destination formal parameter but we
    also must decouple the these types from the ones in which operations
    are performed.

    This patch does that, even though we do not store or stream the
    operation types, instead we simply limit ourselves to tcc_comparisons
    and operations for which the first operand and the result are of the
    same type as determined by expr_type_first_operand_type_p.  If we
    wanted to go beyond these, we would indeed need to store/stream the
    respective operation type.

    ipa_value_from_jfunc needs an additional check that res_type is not
    NULL because it is not called just from within IPA-CP (where we know
    we have a destination lattice slot belonging to a defined parameter)
    but also from inlining, ipa-fnsummary and ipa-modref where it is used
    to examine a call to a function with variadic arguments and we do not
    have types for the unknown parameters.  But we cannot really work with
    those or estimate any benefits when it comes to them, so ignoring them
    should be OK.

    Even after this patch, ipa_get_jf_arith_result has a parameter called
    res_type in which it performs operations for aggregate jump functions,
    where we do not allow type conversions when constucting the jump
    functions and the type is the type of the stored data.  In GCC 16, we
    could relax this and allow conversions like for scalars.

    gcc/ChangeLog:

    2025-01-20  Martin Jambor  <mjam...@suse.cz>

            PR ipa/118097
            * ipa-cp.cc (ipa_get_jf_arith_result): Adjust comment.
            (ipa_get_jf_pass_through_result): Removed.
            (ipa_value_from_jfunc): Use directly ipa_get_jf_arith_result, do
            not specify operation type but make sure we check and possibly
            convert the result.
            (get_val_across_arith_op): Remove the last parameter, always pass
            NULL_TREE to ipa_get_jf_arith_result in its last argument.
            (propagate_vals_across_arith_jfunc): Do not pass res_type to
            get_val_across_arith_op.
            (propagate_vals_across_pass_through): Add checking assert that
            parm_type is not NULL.

    gcc/testsuite/ChangeLog:

    2025-01-24  Martin Jambor  <mjam...@suse.cz>

            PR ipa/118097
            * gcc.dg/ipa/pr118097.c: New test.
            * gcc.dg/ipa/pr118535.c: Likewise.
            * gcc.dg/ipa/ipa-notypes-1.c: Likewise.
  • [Bug ipa/118097] [15 regression... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to