https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103464

--- Comment #16 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Richard Biener from comment #13)
> Note that r12-5522-g661c02e54ea72fb5 doubled the stack use of the frame by
> adding another int_range_max local to range_of_phi.
> 
> First of all in the rev we should have used intersect_, not union_, and if we
> consider that we can simply treat it like single_arg (which we even set),

It needs to be union... we accumulate all the incoming ranges. we start with
UNDEFINED and add to it any ranges we find coming in on edges.

> and thus elide equiv_range completely by using arg_range which is already
> computed?  If there are only equivalences to the PHI def then the PHI must
> be undefined (but I wonder how such PHI is even possible - did you have a
> testcase for this?)


The original patch is a bit wrong, but to address the question, the argument is
not necessarily equivalent everywhere...  just in the source block for the phi
argument. and may not be equivalent in this block. Just on the edge. 

When the argument was equivalent in the source block, it means it cannot
provide any new information to the range being calculated (because it had to
get its range from this def), and so we ignore the range unless there are no
other ranges provided for input.  Then we give up and use it.   

This is simply a mechanism to help defer pessimistic assumptions around back
edges in some common patterns we see.

Reply via email to