[Bug tree-optimization/101186] predictable comparison of integer variables not folded

dizhao at os dot amperecomputing.com gcc-bugzilla@gcc.gnu.org
Thu Jun 24 09:08:34 GMT 2021


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

--- Comment #2 from Di Zhao <dizhao at os dot amperecomputing.com> ---
(In reply to Richard Biener from comment #1)
> The complication is that the a == b equivalence has to be taken into account
> to relate the c < a and c >= b relations.
> 
> Maybe the new relation code can do sth here, but confirmed on trunk.
> 
> void g (int a, int b, int x, int y)
> {
>   int c = y;
>   if (a != 0)
>     c = x;
>   while (b < 1000)
>   // without this loop, jump thread & VRP can remove dead code
>     {
>       if (a != 0)
> 	{
> 	  if (c > x)
> 	    printf ("Unreachable!");
> 	}
> 
> that's also a classical example for predicated value-numbering (which we
> don't implement).

I've implemented a patch on FRE regarding this and will send it to patches
mailing list soon. 

Thanks


More information about the Gcc-bugs mailing list