------- Comment #2 from pinskia at gcc dot gnu dot org  2008-04-07 01:46 -------
(In reply to comment #1)
> Confirmed.  I think this is the same issue as PRE of globals.

It is as if you change the source to be:
int g, g2;
int foo(int p, int *gp)
{
   int t = 0;
   if (p)
      t = *gp + 1;

   return (*gp + t);
}
--- CUT ---
We get the correct optimization:
foo (p, gp)
{
  int prephitmp.9;
  int t;

<bb 2>:
  if (p != 0)
    goto <bb 4>;
  else
    goto <bb 3>;

<bb 3>:
  prephitmp.9 = *gp;
  t = 0;
  goto <bb 5>;

<bb 4>:
  prephitmp.9 = *gp;
  t = prephitmp.9 + 1;

<bb 5>:
  return prephitmp.9 + t;

}


*** This bug has been marked as a duplicate of 23455 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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

Reply via email to