https://gcc.gnu.org/g:4f19487f2606d25516d31f0279101deea9772da4

commit r15-9429-g4f19487f2606d25516d31f0279101deea9772da4
Author: Martin Jambor <mjam...@suse.cz>
Date:   Mon Apr 14 14:21:15 2025 +0200

    ipa-cp: Use the stored and streamed pass-through types in ipa-vr (PR118785)
    
    This patch revisits the fix for PR 118785 and intead of deducing the
    necessary operation type it just uses the value collected and streamed
    by an earlier patch.  The main advantage is that we do not rely on
    expr_type_first_operand_type_p enumarating all operations.
    
    gcc/ChangeLog:
    
    2025-03-20  Martin Jambor  <mjam...@suse.cz>
    
            PR ipa/118785
            * ipa-cp.cc (ipa_vr_intersect_with_arith_jfunc): Use the stored
            and streamed type of arithmetic pass-through functions.

Diff:
---
 gcc/ipa-cp.cc | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index 637bc49f0482..21033c666bf4 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -1735,24 +1735,7 @@ ipa_vr_intersect_with_arith_jfunc (vrange &vr,
       const value_range *inter_vr;
       if (operation != NOP_EXPR)
        {
-         /* Since we construct arithmetic jump functions even when there is a
-             type conversion in between the operation encoded in the jump
-             function and when it is passed in a call argument, the IPA
-             propagation phase must also perform the operation and conversion
-             in two separate steps.
-
-            TODO: In order to remove the use of expr_type_first_operand_type_p
-            predicate we would need to stream the operation type, ideally
-            encoding the whole jump function as a series of expr_eval_op
-            structures.  */
-
-         tree operation_type;
-         if (expr_type_first_operand_type_p (operation))
-           operation_type = src_type;
-         else if (operation == ABSU_EXPR)
-           operation_type = unsigned_type_for (src_type);
-         else
-           return;
+         tree operation_type = ipa_get_jf_pass_through_op_type (jfunc);
          op_res.set_varying (operation_type);
          if (!ipa_vr_operation_and_type_effects (op_res, src_vr, operation,
                                                  operation_type, src_type))
@@ -1782,14 +1765,7 @@ ipa_vr_intersect_with_arith_jfunc (vrange &vr,
   value_range op_vr (TREE_TYPE (operand));
   ipa_get_range_from_ip_invariant (op_vr, operand, context_node);
 
-  tree operation_type;
-  if (TREE_CODE_CLASS (operation) == tcc_comparison)
-    operation_type = boolean_type_node;
-  else if (expr_type_first_operand_type_p (operation))
-    operation_type = src_type;
-  else
-    return;
-
+  tree operation_type = ipa_get_jf_pass_through_op_type (jfunc);
   value_range op_res (operation_type);
   if (!ipa_vr_supported_type_p (operation_type)
       || !handler.operand_check_p (operation_type, src_type, op_vr.type ())

Reply via email to