void
ipcp_bits_lattice::print (FILE *f)
{
+ if (bottom_p ())
+ {
+ fprintf (f, " Bits unusable (BOTTOM)\n");
+ return;
+ }
+
if (top_p ())
- fprintf (f, " Bits unknown (TOP)\n");
- else if (bottom_p ())
- fprintf (f, " Bits unusable (BOTTOM)\n");
+ fprintf (f, " Bits unknown (TOP)");
else
{
fprintf (f, " Bits: value = ");
ipcp_print_widest_int (f, get_value ());
fprintf (f, ", mask = ");
ipcp_print_widest_int (f, get_mask ());
- fprintf (f, "\n");
}
+
+ if (m_recipient_only)
+ fprintf (f, " (recipient only)");
+ fprintf (f, "\n");
}
/* Print value range lattice to F. */
void
ipcp_vr_lattice::print (FILE * f)
{
+ if (m_recipient_only)
+ fprintf (f, "(recipient only) ");
m_vr.dump (f);
}
return true;
}
+/* Set the flag that this lattice is a recipient only, return true if it was
+ not set before. */
+
+bool
+ipcp_vr_lattice::set_recipient_only ()
+{
+ if (m_recipient_only)
+ return false;
+ m_recipient_only = true;
+ return true;
+}
+
/* Set lattice value to bottom, if it already isn't the case. */
bool
return wi::ne_p (wi::bit_and (wi::bit_not (m_mask), m_value), 0);
}
+/* Set the flag that this lattice is a recipient only, return true if it was not
+ set before. */
+
+bool
+ipcp_bits_lattice::set_recipient_only ()
+{
+ if (m_recipient_only)
+ return false;
+ m_recipient_only = true;
+ return true;
+}
+
/* Convert operand to value, mask form. */
void
}
/* Mark bot aggregate and scalar lattices as containing an unknown variable,
- return true is any of them has not been marked as such so far. */
+ return true is any of them has not been marked as such so far. If if
+ MAKE_SIMPLE_RECIPIENTS is true, set the lattices that can only hold one
+ value to being recipients only, otherwise also set them to bottom. */
static inline bool
-set_all_contains_variable (class ipcp_param_lattices *plats)
+set_all_contains_variable (class ipcp_param_lattices *plats,
+ bool make_simple_recipients = false)
{
bool ret;
ret = plats->itself.set_contains_variable ();
ret |= plats->ctxlat.set_contains_variable ();
ret |= set_agg_lats_contain_variable (plats);
- ret |= plats->bits_lattice.set_to_bottom ();
- ret |= plats->m_value_range.set_to_bottom ();
+ if (make_simple_recipients)
+ {
+ ret |= plats->bits_lattice.set_recipient_only ();
+ ret |= plats->m_value_range.set_recipient_only ();
+ }
+ else
+ {
+ ret |= plats->bits_lattice.set_to_bottom ();
+ ret |= plats->m_value_range.set_to_bottom ();
+ }
return ret;
}
{
plats->m_value_range.init (type);
if (variable)
- set_all_contains_variable (plats);
+ set_all_contains_variable (plats, true);
}
}
result of x & 0xff == 0xff, which gets computed during ccp1 pass
and we store it in jump function during analysis stage. */
- if (!src_lats->bits_lattice.bottom_p ())
+ if (!src_lats->bits_lattice.bottom_p ()
+ || src_lats->bits_lattice.recipient_only_p ())
{
if (!op_type)
op_type = ipa_get_type (caller_info, src_idx);
= ipa_get_parm_lattices (caller_info, src_idx);
tree operand_type = ipa_get_type (caller_info, src_idx);
- if (src_lats->m_value_range.bottom_p ())
+ if (src_lats->m_value_range.bottom_p ()
+ || src_lats->m_value_range.recipient_only_p ())
return dest_lat->set_to_bottom ();
if (ipa_get_jf_pass_through_operation (jfunc) == NOP_EXPR
bool do_vr = true;
bool do_bits = true;
+ /* If the function is not local, the gathered information is only useful
+ for clones. */
+ if (!node->local)
+ continue;
+
if (!info || !opt_for_fn (node->decl, flag_ipa_vrp))
{
if (dump_file)
bool set_to_bottom ();
bool set_to_constant (widest_int, widest_int);
bool known_nonzero_p () const;
+ bool set_recipient_only ();
+ bool recipient_only_p () const {return m_recipient_only; }
widest_int get_value () const { return m_value; }
widest_int get_mask () const { return m_mask; }
enum { IPA_BITS_UNDEFINED, IPA_BITS_CONSTANT, IPA_BITS_VARYING }
m_lattice_val = IPA_BITS_UNDEFINED;
+ /* Set to true if the lattice is valid only as a recipient of propagatad
+ values but cannot be used as source of propagation because there may be
+ unknown callers. */
+ bool m_recipient_only;
+
/* Similar to ccp_lattice_t, mask represents which bits of value are constant.
If a bit in mask is set to 0, then the corresponding bit in
value is known to be constant. */
{
public:
value_range m_vr;
+ /* Set to true if the lattice is valid only as a recipient of propagatad
+ values but cannot be used as source of propagation because there may be
+ unknown callers. */
+ bool m_recipient_only;
inline bool bottom_p () const;
inline bool top_p () const;
inline bool set_to_bottom ();
+ bool set_recipient_only ();
+ bool recipient_only_p () const {return m_recipient_only; }
bool meet_with (const vrange &p_vr);
bool meet_with (const ipcp_vr_lattice &other);
void init (tree type);
m_vr.set_type (type);
// Otherwise m_vr will default to unsupported_range.
+ m_recipient_only = false;
}
/* Structure containing lattices for a parameter itself and for pieces of