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

Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Joost.VandeVondele at mat dot 
ethz
                   |                            |.ch

--- Comment #3 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> 
---
(In reply to Andrew Pinski from comment #0)
> Jump threading causes bad interactions with loops:
> int f(int t, int a, int x)
> {
>   int n, g;
>   if (t)
>    n = a;
>   else
>    n = 4;
>   for (g=0; g<n; g++)
>     x++;
>   return x;
> }
> 
> This should be optimized to:
> int f(int t, int a, int x)
> {
>   int n, g;
>   if (t)
>    n = a;
>   else
>    n = 4;
>   x+=n;
>   return x;
> }
> But is not because of jump threading getting in the way to dect that the
> loop is finite.

actually, it should not, for a<0 and t=1.

Reply via email to