http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49234



Richard Biener <rguenth at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |iant at google dot com



--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-01 
11:45:54 UTC ---

(In reply to comment #9)

> (In reply to comment #3)

> > We hit:

> > 163724    rguenth       /* Similarly, if the new maximum is smaller or 
> > larger

> > than

> > 163724    rguenth        the previous one, go all the way to +INF.  */

> > 163724    rguenth       if (cmp_max < 0 || cmp_max > 0)

> > 163724    rguenth       {

> > 163724    rguenth         if (!needs_overflow_infinity (TREE_TYPE

> > (vr_result.max))

> > 163724    rguenth             || !vrp_var_may_overflow (lhs, phi))

> > 163724    rguenth           vr_result.max = TYPE_MAX_VALUE (TREE_TYPE

> > (vr_result.max));

> > 163724    rguenth         else if (supports_overflow_infinity (TREE_TYPE

> > (vr_result.max)))

> > 163724    rguenth           vr_result.max =

> > 163724    rguenth               positive_overflow_infinity (TREE_TYPE

> > (vr_result.max));

> > 163724    rguenth       }

> > 

> 

> (In reply to comment #8)

> > 

> > Does this seem like an approach worth exploring (this silences the 
> > warning), or

> > does anyone have a better suggestion?

> 

> Isn't the problem that vrp_var_may_overflow returns true even though 'state'

> cannot overflow? Jakub says:

> 

> > As the IV (i) might overflow, vrp_var_may_overflow returns true.

> > In particular, chrec is SCEV_NOT_KNOWN.  Thus it just in case sets

> > vr_result.max to +INF(OVF) and later on we warn about it.

> > Before hitting this code, vr_result contains the right range [0, 2], but it

> > doesn't know it can safely use that.

> 

> Couldn't be possible to detect this by the fact that 'state' does not depend 
> on

> anything variable?

> 

> Also, in such a case, the algorithm cannot iterate more than the number of phi

> nodes in the loop (if I understand the VRP correctly, which I most likely

> don't).

> 

> But I looked around and I honestly don't know how to implement this idea.

> 

> In any case, your patch would need to adjust the code for the minimum also, 
> no?

> Because the same behaviour can be triggered just by using negative numbers to

> trigger a negative overflow infinity.



I think we should simply not set overflow on this code path in any case.  We

have (OVF) just for the sake of -Wstrict-overflow warnings which in VRP are

implemeted in the worst possible way.



The issue with iterating is that you either can re-create the issue

with a different testcase or you blow up compile-time.



When somebody wants to improve VRP for SSA cycles then the way to go is

to compute the SSA SCC, classify it (in this case we only have assigns

from constants, not increments or decrements) and choose a solving

strathegy.



Oh, and of course strict-overflow warnings are all Ians fault ;)

Reply via email to