After reviewing the code involving arithmetic pass-through jump functions I found out that we actually do check that the type of the LHS is compatible with the type of the first operand on the RHS. Now that we stream the types of the LHS of these operations, this is no longer necessary - and we happen not to do it for unary operations, something I have missed when reviewing their addition. This patch therefore removes these checks.
Bootstrapped and tested and LTO bootstrapped on x86_64-linux but my plan is to propose this only in the next stage 1. Thanks, Martin gcc/ChangeLog: 2025-03-21 Martin Jambor <mjam...@suse.cz> * ipa-prop.cc (compute_complex_assign_jump_func): Remove test for comparison operation or type compatibility of LHS and RHS1. (analyze_agg_content_value): Likewise. --- gcc/ipa-prop.cc | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc index d882b997bf4..59ef00db823 100644 --- a/gcc/ipa-prop.cc +++ b/gcc/ipa-prop.cc @@ -1530,11 +1530,7 @@ compute_complex_assign_jump_func (struct ipa_func_body_info *fbi, case GIMPLE_BINARY_RHS: { tree op2 = gimple_assign_rhs2 (stmt); - if (!is_gimple_ip_invariant (op2) - || ((TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) - != tcc_comparison) - && !useless_type_conversion_p (TREE_TYPE (name), - TREE_TYPE (op1)))) + if (!is_gimple_ip_invariant (op2)) return; ipa_set_jf_arith_pass_through (jfunc, index, op2, @@ -2032,11 +2028,6 @@ analyze_agg_content_value (struct ipa_func_body_info *fbi, } else return; - - if (TREE_CODE_CLASS (code) != tcc_comparison - && !useless_type_conversion_p (TREE_TYPE (lhs), - TREE_TYPE (rhs1))) - return; } break; -- 2.48.1