else
pd.offset = pos;
pd.size = tz;
- void *r = push_partial_def (pd, 0, 0, prec);
+ void *r = push_partial_def (pd, 0, 0, 0, prec);
gcc_assert (r == NULL_TREE);
}
pos += tz;
}
~vn_walk_cb_data ();
void *finish (alias_set_type, alias_set_type, tree);
- void *push_partial_def (const pd_data& pd,
- alias_set_type, alias_set_type, HOST_WIDE_INT);
+ void *push_partial_def (pd_data pd,
+ alias_set_type, alias_set_type, HOST_WIDE_INT,
+ HOST_WIDE_INT);
vn_reference_t vr;
ao_ref orig_ref;
on failure. */
void *
-vn_walk_cb_data::push_partial_def (const pd_data &pd,
+vn_walk_cb_data::push_partial_def (pd_data pd,
alias_set_type set, alias_set_type base_set,
+ HOST_WIDE_INT offseti,
HOST_WIDE_INT maxsizei)
{
const HOST_WIDE_INT bufsize = 64;
|| BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN)
return (void *)-1;
+ /* Turn too large constant stores into non-constant stores. */
+ if (CONSTANT_CLASS_P (pd.rhs) && pd.size > bufsize * BITS_PER_UNIT)
+ pd.rhs = error_mark_node;
+
+ /* And for non-constant or CONSTRUCTOR stores shrink them to only keep at
+ most a partial byte before and/or after the region. */
+ if (!CONSTANT_CLASS_P (pd.rhs))
+ {
+ if (pd.offset < offseti)
+ {
+ HOST_WIDE_INT o = ROUND_DOWN (offseti - pd.offset, BITS_PER_UNIT);
+ gcc_assert (pd.size > o);
+ pd.size -= o;
+ pd.offset += o;
+ }
+ if (pd.size > maxsizei)
+ pd.size = maxsizei + ((pd.size - maxsizei) % BITS_PER_UNIT);
+ }
+
+ pd.offset -= offseti;
+
bool pd_constant_p = (TREE_CODE (pd.rhs) == CONSTRUCTOR
|| CONSTANT_CLASS_P (pd.rhs));
if (partial_defs.is_empty ())
{
pd_data pd;
pd.rhs = build_constructor (NULL_TREE, NULL);
- pd.offset = offset2i - offseti;
+ pd.offset = offset2i;
pd.size = leni << LOG2_BITS_PER_UNIT;
- return data->push_partial_def (pd, 0, 0, maxsizei);
+ return data->push_partial_def (pd, 0, 0, offseti, maxsizei);
}
}
by a later def. */
pd_data pd;
pd.rhs = gimple_assign_rhs1 (def_stmt);
- pd.offset = offset2i - offseti;
+ pd.offset = offset2i;
pd.size = size2i;
return data->push_partial_def (pd, ao_ref_alias_set (&lhs_ref),
ao_ref_base_alias_set (&lhs_ref),
- maxsizei);
+ offseti, maxsizei);
}
}
}
if (TREE_CODE (rhs) == SSA_NAME)
rhs = SSA_VAL (rhs);
pd.rhs = rhs;
- pd.offset = offset2i - offseti;
+ pd.offset = offset2i;
pd.size = size2i;
return data->push_partial_def (pd, ao_ref_alias_set (&lhs_ref),
ao_ref_base_alias_set (&lhs_ref),
- maxsizei);
+ offseti, maxsizei);
}
}
}
{
pd_data pd;
pd.rhs = SSA_VAL (def_rhs);
- pd.offset = offset2i - offseti;
+ pd.offset = offset2i;
pd.size = size2i;
return data->push_partial_def (pd, ao_ref_alias_set (&lhs_ref),
ao_ref_base_alias_set (&lhs_ref),
- maxsizei);
+ offseti, maxsizei);
}
}
}
pd.size = maxsizei;
return data->push_partial_def (pd, ao_ref_alias_set (&lhs_ref),
ao_ref_base_alias_set (&lhs_ref),
- maxsizei);
+ 0, maxsizei);
}
}