------- Comment #2 from rakdver at gcc dot gnu dot org  2006-11-06 11:51 -------
> Have you tried
> 
> void foo (void);
> void bar (void)
> {
>   int i, j;
>   i = 0;
>   for (j = 0; j < 10000; j++)
>     if (i)
>       foo ();
> }

This would work, obviously.

> For the original problem, why don't we propagate constants in
> 
>   #   i_3 = V_MUST_DEF <i_2>;
>   i = 0;
> 
>   # NONLOCAL.6_19 = PHI <NONLOCAL.6_9(5), NONLOCAL.6_11(2)>;
>   # i_18 = PHI <i_7(5), i_3(2)>;
> 
> i.e. replacing the use of i_3 with just the constant 0?

Because i is a virtual operand, not real one.

CCP could probably be taught to handle this case, I will check how difficult
that would be.


-- 

rakdver at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rakdver at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-11-06 11:51:38
               date|                            |


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

Reply via email to