+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
}
}
+/* 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
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
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);
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 *);
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);
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
&& 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? */
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;
}
}
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)
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);
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;
gimple *lastg;
tree op;
int index;
- HOST_WIDE_INT size;
+ poly_int64 size;
struct agg_position_info aggpos;
edge e;
edge_iterator ei;
{
tree parm;
int index;
- HOST_WIDE_INT size;
+ poly_int64 size;
while (UNARY_CLASS_P (expr))
expr = TREE_OPERAND (expr, 0);
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
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;
{
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);
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);
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;
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
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;
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);
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;
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;
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));
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. */