https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118097
--- Comment #40 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:6b6611f81476b6375c90859d85331c2981a2ce51 commit r15-9430-g6b6611f81476b6375c90859d85331c2981a2ce51 Author: Martin Jambor <mjam...@suse.cz> Date: Mon Apr 14 14:21:15 2025 +0200 ipa-cp: Use the collected pass-through types to propgate constants (PR118097) This patch revisits the fix for PR 118097 and instead of deducing the necessary operation type it just uses the value collected and streamed by an earlier patch. It is bigger than the ones for propagating value ranges and known bits because we track constants both in parameters themselves and also in memory they point to or within aggregates, we clone functions for them and we do fancy things for some types of recursive calls. In the case of constants in aggregates or passed by reference, the situation should not change because the code creating jump functions for them does not allow type-casts, unlike for the plain ones. However, this patch changes how we handle them for the sake of consistency and also so that we can try and eliminate this limitation in the next stage 1. gcc/ChangeLog: 2025-03-20 Martin Jambor <mjam...@suse.cz> PR ipa/118097 * ipa-cp.cc (ipa_get_jf_arith_result): Require res_operand for anything except NOP_EXPR or ADDR_EXPR, document it and remove the code trying to deduce it. (ipa_value_from_jfunc): Use the stored and streamed type of arithmetic pass-through functions. (ipa_agg_value_from_jfunc): Use the stored and streamed type of arithmetic pass-through functions, convert to the type used to store the value if necessary. (get_val_across_arith_op): New parameter op_type, pass it to ipa_get_jf_arith_result. (propagate_vals_across_arith_jfunc): New parameter op_type, pass it to get_val_across_arith_op. (propagate_vals_across_pass_through): Use the stored and streamed type of arithmetic pass-through functions. (propagate_aggregate_lattice): Likewise. (push_agg_values_for_index_from_edge): Use the stored and streamed type of arithmetic pass-through functions, convert to the type used to store the value if necessary.