This is the mail archive of the
mailing list for the GCC project.
Re: [range-ops] patch 01/04: types for VR_UNDEFINED and VR_VARYING
On 7/24/19 2:18 PM, Jeff Law wrote:
On 7/24/19 11:00 AM, Richard Biener wrote:
[ Big snip, ignore missing reply attributions... ]
it. But I'd claim that if callers are required not to change these
ranges, then the callers are fundamentally broken. I'm not sure
what the "sanitization" is really buying you here. Can you point
to something specific?
But you lose the sanitizing that nobody can change it and the
changed info leaks to other SSA vars.
As said, fix all callers to deal with NULL.
But I argue the current code is exactly optimal and safe.
ANd I'd argue that it's just plain broken and that the
sanitization you're referring to points to something broken
elsewhere, higher up in the callers.
Another option is to make get_value_range return by value and the
only way to change the lattice to call an appropriate set function. I
think we already do the latter in all cases (but we use
get_value_range in the setter) and returning by reference is just
eliding the copy.
OK, so what I think you're getting at (and please correct me if I'm
wrong) is that once the lattice values are set, you don't want something
changing the recorded ranges underneath?
ISTM the way to enforce that is to embed the concept in the class and
enforce it by not allowing direct manipulation of range by the clients.
So a client that wants this behavior somehow tells the class that
ranges are "set in stone" and from that point the setters don't allow
changing the underlying ranges.
I just want to make sure we're on the same page WRT why you think the
constant varying range object is useful.
That is not the functionality we are seeing.
whenever get_value_range silently returns a CONST varying node, the
ONLY way you can tell that the node might possibly be const elsewhere
would be if you first check that it is varying, like in :
vr_values::set_defs_to_varying (gimple *stmt)
FOR_EACH_SSA_TREE_OPERAND (def, stmt, i, SSA_OP_DEF)
value_range *vr = get_value_range (def);
/* Avoid writing to vr_const_varying get_value_range may
if (!vr->varying_p ())
Which means there can be *no* context in which we ever try move one of
these nodes from varying to anything else, or we'd trap on a write to
Which means no place is ever trying to change those nodes from varying
to anything else. But nothing is preventing changes from other ranges
to something else.
Which also means the only thing this approach accomplishes is to force
us to check if a node is already varying, so that we don't overwrite the
node to varying just in case its a hidden const.
how can this hidden const node really be useful?
I submit this is just a dangerous way to flag previously unprocessed
nodes as VARYING for the duration of the pass after values_propagated is
set... not some higher level "Don't change this range any more" plan.
Its already bottom of the lattice.. it isn't going anywhere.