public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/27800]  New: extra temprorary created when gimplifying return
@ 2006-05-29 18:20 dann at godzilla dot ics dot uci dot edu
  2006-05-29 20:52 ` [Bug tree-optimization/27800] " dann at godzilla dot ics dot uci dot edu
  2006-05-29 21:14 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2006-05-29 18:20 UTC (permalink / raw)
  To: gcc-bugs

One would think that the temporaries created when gimplifying the following
2 functions would be the same:

void hhh (int a, int b, int c){ bar (a?b:c); }
int iii (int a, int b, int c){ return (a?b:c); }

But they are not:

hhh (a, b, c)
{
  int iftmp.0;
  if (a != 0)
    {
      iftmp.0 = b;
    }
  else
    {
      iftmp.0 = c;
    }
  bar (iftmp.0);
}

This one is fine. 
But this one:

iii (a, b, c)
{
  int D.2128;
  int iftmp.1;
  if (a != 0)
    {
      iftmp.1 = b;
    }
  else
    {
      iftmp.1 = c;
    }
  D.2128 = iftmp.1;
  return D.2128;
}
creates an extra temporary for the return expression. It would be more memory
efficient if it would just use "iftmp.1" as the first function does.


-- 
           Summary: extra temprorary created when gimplifying return
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/27800] extra temprorary created when gimplifying return
  2006-05-29 18:20 [Bug tree-optimization/27800] New: extra temprorary created when gimplifying return dann at godzilla dot ics dot uci dot edu
@ 2006-05-29 20:52 ` dann at godzilla dot ics dot uci dot edu
  2006-05-29 21:14 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2006-05-29 20:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dann at godzilla dot ics dot uci dot edu  2006-05-29 20:51 -------
An even simpler example which occurs quite frequently in programs:

int jjj (int a){ return bar (a); }

jjj (a)
{
  int D.1891;
  int D.1892;

  D.1892 = bar (a);
  D.1891 = D.1892;
  return D.1891;
}


-- 

dann at godzilla dot ics dot uci dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|extra temprorary created    |extra temprorary created
                   |when gimplifying return     |when gimplifying return


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/27800] extra temprorary created when gimplifying return
  2006-05-29 18:20 [Bug tree-optimization/27800] New: extra temprorary created when gimplifying return dann at godzilla dot ics dot uci dot edu
  2006-05-29 20:52 ` [Bug tree-optimization/27800] " dann at godzilla dot ics dot uci dot edu
@ 2006-05-29 21:14 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-29 21:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-05-29 21:13 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-29 21:13:57
               date|                            |


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-29 21:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-29 18:20 [Bug tree-optimization/27800] New: extra temprorary created when gimplifying return dann at godzilla dot ics dot uci dot edu
2006-05-29 20:52 ` [Bug tree-optimization/27800] " dann at godzilla dot ics dot uci dot edu
2006-05-29 21:14 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).