]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Make IPA predicate::size a poly_int64
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 7 Aug 2019 13:18:35 +0000 (13:18 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 7 Aug 2019 13:18:35 +0000 (13:18 +0000)
This patch changes the IPA predicate::size field from a HOST_WIDE_INT
to a poly_int64.

2019-08-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* data-streamer.h (streamer_write_poly_uint64): Declare.
(streamer_read_poly_uint64): Likewise.
* data-streamer-in.c (streamer_read_poly_uint64): New function.
* data-streamer-out.c (streamer_write_poly_uint64): Likewise.
* ipa-predicate.h (condition::size): Turn into a poly_int64.
(add_condition): Take a poly_int64 size.
* ipa-predicate.c (add_condition): Likewise.
* ipa-prop.h (ipa_load_from_parm_agg): Take a poly_int64 size pointer.
* ipa-prop.c (ipa_load_from_parm_agg): Likewise.
(ipcp_modif_dom_walker::before_dom_children): Update accordingly.
* ipa-fnsummary.c (evaluate_conditions_for_known_args): Handle
condition::size as a poly_int64.
(unmodified_parm_1): Take a poly_int64 size pointer.
(unmodified_parm): Likewise.
(unmodified_parm_or_parm_agg_item): Likewise.
(set_cond_stmt_execution_predicate): Update accordingly.
(set_switch_stmt_execution_predicate): Likewise.
(will_be_nonconstant_expr_predicate): Likewise.
(will_be_nonconstant_predicate): Likewise.
(inline_read_section): Stream condition::size as a poly_int.
(ipa_fn_summary_write): Likewise.

From-SVN: r274162

gcc/ChangeLog
gcc/data-streamer-in.c
gcc/data-streamer-out.c
gcc/data-streamer.h
gcc/ipa-fnsummary.c
gcc/ipa-predicate.c
gcc/ipa-predicate.h
gcc/ipa-prop.c
gcc/ipa-prop.h

index c80ab8310221a37c8b3e37825315d198952bce35..a4b0c35f4ba36bd3aa430ee5cf5426cccd37bbe3 100644 (file)
@@ -1,3 +1,27 @@
+2019-08-07  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * data-streamer.h (streamer_write_poly_uint64): Declare.
+       (streamer_read_poly_uint64): Likewise.
+       * data-streamer-in.c (streamer_read_poly_uint64): New function.
+       * data-streamer-out.c (streamer_write_poly_uint64): Likewise.
+       * ipa-predicate.h (condition::size): Turn into a poly_int64.
+       (add_condition): Take a poly_int64 size.
+       * ipa-predicate.c (add_condition): Likewise.
+       * ipa-prop.h (ipa_load_from_parm_agg): Take a poly_int64 size pointer.
+       * ipa-prop.c (ipa_load_from_parm_agg): Likewise.
+       (ipcp_modif_dom_walker::before_dom_children): Update accordingly.
+       * ipa-fnsummary.c (evaluate_conditions_for_known_args): Handle
+       condition::size as a poly_int64.
+       (unmodified_parm_1): Take a poly_int64 size pointer.
+       (unmodified_parm): Likewise.
+       (unmodified_parm_or_parm_agg_item): Likewise.
+       (set_cond_stmt_execution_predicate): Update accordingly.
+       (set_switch_stmt_execution_predicate): Likewise.
+       (will_be_nonconstant_expr_predicate): Likewise.
+       (will_be_nonconstant_predicate): Likewise.
+       (inline_read_section): Stream condition::size as a poly_int.
+       (ipa_fn_summary_write): Likewise.
+
 2019-08-07  Martin Liska  <mliska@suse.cz>
 
        * fold-const.c (twoval_comparison_p): Replace int
index 11ad084780b21d1481ae26da577b2ebb275bb11b..d9742d5334f1a81ae0c16d1f861c78e8d51d2dcd 100644 (file)
@@ -175,6 +175,17 @@ streamer_read_hwi (class lto_input_block *ib)
     }
 }
 
+/* Read a poly_uint64 from IB.  */
+
+poly_uint64
+streamer_read_poly_uint64 (class lto_input_block *ib)
+{
+  poly_uint64 res;
+  for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
+    res.coeffs[i] = streamer_read_uhwi (ib);
+  return res;
+}
+
 /* Read gcov_type value from IB.  */
 
 gcov_type
index d058efd92c025403454ef5e3db0b0d034a35bec9..54d080ea8d90d976e9c60b07086a6221aa57c335 100644 (file)
@@ -220,6 +220,15 @@ streamer_write_hwi (struct output_block *ob, HOST_WIDE_INT work)
   streamer_write_hwi_stream (ob->main_stream, work);
 }
 
+/* Write a poly_uint64 value WORK to OB->main_stream.  */
+
+void
+streamer_write_poly_uint64 (struct output_block *ob, poly_uint64 work)
+{
+  for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
+    streamer_write_uhwi_stream (ob->main_stream, work.coeffs[i]);
+}
+
 /* Write a gcov counter value WORK to OB->main_stream.  */
 
 void
index c8bfd9a70304ba51c5afcfb1efaa173eca65d038..c1b150138628bcda71894745463c193a28a8a550 100644 (file)
@@ -53,6 +53,7 @@ HOST_WIDE_INT bp_unpack_var_len_int (struct bitpack_d *);
 void streamer_write_zero (struct output_block *);
 void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT);
 void streamer_write_hwi (struct output_block *, HOST_WIDE_INT);
+void streamer_write_poly_uint64 (struct output_block *, poly_uint64);
 void streamer_write_gcov_count (struct output_block *, gcov_type);
 void streamer_write_string (struct output_block *, struct lto_output_stream *,
                            const char *, bool);
@@ -82,6 +83,7 @@ const char *bp_unpack_indexed_string (class data_in *, struct bitpack_d *,
 const char *bp_unpack_string (class data_in *, struct bitpack_d *);
 unsigned HOST_WIDE_INT streamer_read_uhwi (class lto_input_block *);
 HOST_WIDE_INT streamer_read_hwi (class lto_input_block *);
+poly_uint64 streamer_read_poly_uint64 (class lto_input_block *);
 gcov_type streamer_read_gcov_count (class lto_input_block *);
 wide_int streamer_read_wide_int (class lto_input_block *);
 widest_int streamer_read_widest_int (class lto_input_block *);
index fe125aca62c51ee7688af00f5cca9cb3e9a6235f..278bf606661970aaa33e6a6240d71f7a42161ae5 100644 (file)
@@ -382,7 +382,7 @@ evaluate_conditions_for_known_args (struct cgraph_node *node,
          continue;
        }
 
-      if (tree_to_shwi (TYPE_SIZE (TREE_TYPE (val))) != c->size)
+      if (maybe_ne (tree_to_poly_int64 (TYPE_SIZE (TREE_TYPE (val))), c->size))
        {
          clause |= 1 << (i + predicate::first_dynamic_condition);
          nonspec_clause |= 1 << (i + predicate::first_dynamic_condition);
@@ -922,7 +922,7 @@ mark_modified (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef ATTRIBUTE_UNUSED,
 
 static tree
 unmodified_parm_1 (ipa_func_body_info *fbi, gimple *stmt, tree op,
-                  HOST_WIDE_INT *size_p)
+                  poly_int64 *size_p)
 {
   /* SSA_NAME referring to parm default def?  */
   if (TREE_CODE (op) == SSA_NAME
@@ -930,7 +930,7 @@ unmodified_parm_1 (ipa_func_body_info *fbi, gimple *stmt, tree op,
       && TREE_CODE (SSA_NAME_VAR (op)) == PARM_DECL)
     {
       if (size_p)
-       *size_p = tree_to_shwi (TYPE_SIZE (TREE_TYPE (op)));
+       *size_p = tree_to_poly_int64 (TYPE_SIZE (TREE_TYPE (op)));
       return SSA_NAME_VAR (op);
     }
   /* Non-SSA parm reference?  */
@@ -951,7 +951,7 @@ unmodified_parm_1 (ipa_func_body_info *fbi, gimple *stmt, tree op,
       if (!modified)
        {
          if (size_p)
-           *size_p = tree_to_shwi (TYPE_SIZE (TREE_TYPE (op)));
+           *size_p = tree_to_poly_int64 (TYPE_SIZE (TREE_TYPE (op)));
          return op;
        }
     }
@@ -965,7 +965,7 @@ unmodified_parm_1 (ipa_func_body_info *fbi, gimple *stmt, tree op,
 
 static tree
 unmodified_parm (ipa_func_body_info *fbi, gimple *stmt, tree op,
-                HOST_WIDE_INT *size_p)
+                poly_int64 *size_p)
 {
   tree res = unmodified_parm_1 (fbi, stmt, op, size_p);
   if (res)
@@ -990,7 +990,7 @@ unmodified_parm (ipa_func_body_info *fbi, gimple *stmt, tree op,
 static bool
 unmodified_parm_or_parm_agg_item (struct ipa_func_body_info *fbi,
                                  gimple *stmt, tree op, int *index_p,
-                                 HOST_WIDE_INT *size_p,
+                                 poly_int64 *size_p,
                                  struct agg_position_info *aggpos)
 {
   tree res = unmodified_parm_1 (fbi, stmt, op, size_p);
@@ -1169,7 +1169,7 @@ set_cond_stmt_execution_predicate (struct ipa_func_body_info *fbi,
   gimple *last;
   tree op;
   int index;
-  HOST_WIDE_INT size;
+  poly_int64 size;
   struct agg_position_info aggpos;
   enum tree_code code, inverted_code;
   edge e;
@@ -1254,7 +1254,7 @@ set_switch_stmt_execution_predicate (struct ipa_func_body_info *fbi,
   gimple *lastg;
   tree op;
   int index;
-  HOST_WIDE_INT size;
+  poly_int64 size;
   struct agg_position_info aggpos;
   edge e;
   edge_iterator ei;
@@ -1393,7 +1393,7 @@ will_be_nonconstant_expr_predicate (ipa_func_body_info *fbi,
 {
   tree parm;
   int index;
-  HOST_WIDE_INT size;
+  poly_int64 size;
 
   while (UNARY_CLASS_P (expr))
     expr = TREE_OPERAND (expr, 0);
@@ -1468,7 +1468,7 @@ will_be_nonconstant_predicate (struct ipa_func_body_info *fbi,
   predicate op_non_const;
   bool is_load;
   int base_index;
-  HOST_WIDE_INT size;
+  poly_int64 size;
   struct agg_position_info aggpos;
 
   /* What statments might be optimized away
@@ -1524,7 +1524,7 @@ will_be_nonconstant_predicate (struct ipa_func_body_info *fbi,
     op_non_const = false;
   FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
     {
-      HOST_WIDE_INT size;
+      poly_int64 size;
       tree parm = unmodified_parm (fbi, stmt, use, &size);
       int index;
 
@@ -3292,7 +3292,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
        {
          struct condition c;
          c.operand_num = streamer_read_uhwi (&ib);
-         c.size = streamer_read_uhwi (&ib);
+         c.size = streamer_read_poly_uint64 (&ib);
          c.code = (enum tree_code) streamer_read_uhwi (&ib);
          c.val = stream_read_tree (&ib, data_in);
          bp = streamer_read_bitpack (&ib);
@@ -3446,7 +3446,7 @@ ipa_fn_summary_write (void)
          for (i = 0; vec_safe_iterate (info->conds, i, &c); i++)
            {
              streamer_write_uhwi (ob, c->operand_num);
-             streamer_write_uhwi (ob, c->size);
+             streamer_write_poly_uint64 (ob, c->size);
              streamer_write_uhwi (ob, c->code);
              stream_write_tree (ob, c->val, true);
              bp = bitpack_create (ob->main_stream);
index 49622e9cd337ff3650b0781d19dc0c2b5961224a..775f82bce9f45144b728b9d08a5883efbe9dacf9 100644 (file)
@@ -523,7 +523,7 @@ predicate::stream_out (struct output_block *ob)
 
 predicate
 add_condition (class ipa_fn_summary *summary, int operand_num,
-              HOST_WIDE_INT size, struct agg_position_info *aggpos,
+              poly_int64 size, struct agg_position_info *aggpos,
               enum tree_code code, tree val)
 {
   int i;
@@ -549,7 +549,7 @@ add_condition (class ipa_fn_summary *summary, int operand_num,
   for (i = 0; vec_safe_iterate (summary->conds, i, &c); i++)
     {
       if (c->operand_num == operand_num
-         && c->size == size
+         && maybe_ne (c->size, size)
          && c->code == code
          && c->val == val
          && c->agg_contents == agg_contents
index c2adba30551e4e9e8cac17e43e6bdfcde1730850..237306dc9fe5b837e7687517b14602fdc4a919ba 100644 (file)
@@ -31,7 +31,7 @@ struct GTY(()) condition
      loaded.  */
   HOST_WIDE_INT offset;
   /* Size of the access reading the data (or the PARM_DECL SSA_NAME).  */
-  HOST_WIDE_INT size;
+  poly_int64 size;
   tree val;
   int operand_num;
   ENUM_BITFIELD(tree_code) code : 16;
@@ -228,5 +228,5 @@ private:
 
 void dump_condition (FILE *f, conditions conditions, int cond);
 predicate add_condition (class ipa_fn_summary *summary, int operand_num,
-                        HOST_WIDE_INT size, struct agg_position_info *aggpos,
+                        poly_int64 size, struct agg_position_info *aggpos,
                         enum tree_code code, tree val);
index 344b78ea02fee59eb3cc836ae96f1afe0284c0ae..ce669f800839217478cf2b90316240784ae6b483 100644 (file)
@@ -1059,7 +1059,7 @@ bool
 ipa_load_from_parm_agg (struct ipa_func_body_info *fbi,
                        vec<ipa_param_descriptor, va_gc> *descriptors,
                        gimple *stmt, tree op, int *index_p,
-                       HOST_WIDE_INT *offset_p, HOST_WIDE_INT *size_p,
+                       HOST_WIDE_INT *offset_p, poly_int64 *size_p,
                        bool *by_ref_p, bool *guaranteed_unmodified)
 {
   int index;
@@ -4917,7 +4917,8 @@ ipcp_modif_dom_walker::before_dom_children (basic_block bb)
       struct ipa_agg_replacement_value *v;
       gimple *stmt = gsi_stmt (gsi);
       tree rhs, val, t;
-      HOST_WIDE_INT offset, size;
+      HOST_WIDE_INT offset;
+      poly_int64 size;
       int index;
       bool by_ref, vce;
 
@@ -4952,7 +4953,8 @@ ipcp_modif_dom_walker::before_dom_children (basic_block bb)
          break;
       if (!v
          || v->by_ref != by_ref
-         || tree_to_shwi (TYPE_SIZE (TREE_TYPE (v->value))) != size)
+         || maybe_ne (tree_to_poly_int64 (TYPE_SIZE (TREE_TYPE (v->value))),
+                      size))
        continue;
 
       gcc_checking_assert (is_gimple_ip_invariant (v->value));
index 6470c938ecd75d1fa0cd100cd97343e558e7fb29..30948fb8854001c969a4ed12da32eda593f50c86 100644 (file)
@@ -763,7 +763,7 @@ tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *agg, tree scalar,
 bool ipa_load_from_parm_agg (struct ipa_func_body_info *fbi,
                             vec<ipa_param_descriptor, va_gc> *descriptors,
                             gimple *stmt, tree op, int *index_p,
-                            HOST_WIDE_INT *offset_p, HOST_WIDE_INT *size_p,
+                            HOST_WIDE_INT *offset_p, poly_int64 *size_p,
                             bool *by_ref, bool *guaranteed_unmodified = NULL);
 
 /* Debugging interface.  */