]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa-cp: Use the stored and streamed pass-through types in ipa-vr (PR118785)
authorMartin Jambor <mjambor@suse.cz>
Mon, 14 Apr 2025 12:21:15 +0000 (14:21 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Mon, 14 Apr 2025 12:39:39 +0000 (14:39 +0200)
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  <mjambor@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.

gcc/ipa-cp.cc

index 637bc49f048273f253db35f7f4728aca65699137..21033c666bf4b8db400548bc03ada8f4f18ef8e9 100644 (file)
@@ -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 ())