public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/19827] New: Missed pure/const optimization
@ 2005-02-09  3:09 pinskia at gcc dot gnu dot org
  2005-02-20 19:41 ` [Bug tree-optimization/19827] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-09  3:09 UTC (permalink / raw)
  To: gcc-bugs

The following two function should produce the same asm because we can skip the second call to f:
int f(void) __attribute__((const,pure));

int g(int i, int j)
{
  int k = 0;
  if(i)
    k = f();
  if (j)
    k = f();
  return k;
}
int h(int i, int j)
{
  int k = 0;
  if(i)
    k = f();
  else if (j)
    k = f();
  return k;
}

-- 
           Summary: Missed pure/const optimization
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/19827] Missed pure/const optimization
  2005-02-09  3:09 [Bug tree-optimization/19827] New: Missed pure/const optimization pinskia at gcc dot gnu dot org
@ 2005-02-20 19:41 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-20 19:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-20 14:22 -------
Confirmed.
Well h is still not the most optimal code, the following is:
int m(int i, int j)
{
  int k = 0;
  if(i || j)
    k = f();
  return k;
}

This is very closely related to PR 20083.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-20 14:22:28
               date|                            |


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


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

end of thread, other threads:[~2005-02-20 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-09  3:09 [Bug tree-optimization/19827] New: Missed pure/const optimization pinskia at gcc dot gnu dot org
2005-02-20 19:41 ` [Bug tree-optimization/19827] " 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).