public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/24689]  New: store_ccp is missing an opportunity!?
@ 2005-11-06  2:26 kazu at gcc dot gnu dot org
  2005-11-06  4:34 ` [Bug tree-optimization/24689] store_ccp is missing an opportunity because of call clobber/alias load? pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: kazu at gcc dot gnu dot org @ 2005-11-06  2:26 UTC (permalink / raw)
  To: gcc-bugs

Consider:

extern void bar (unsigned int);

int
foo (void)
{
  char buf[1] = { 3 };
  const char *p = buf;
  const char **q = &p;
  unsigned int ch;
  switch (**q)
    {
    case 1:  ch = 5; break;
    default: ch = 0; break;
    }

#if 1
  bar (ch);
#endif
  return ch;
}

This function should be optimized to "return 0;", but it isn't.

Interestingly, if you change "#if 1" to "#if 0", you are going to get
this optimized.

The testcase is derived from PR 20583.


-- 
           Summary: store_ccp is missing an opportunity!?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at gcc dot gnu dot org


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


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

end of thread, other threads:[~2007-04-12  9:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-06  2:26 [Bug tree-optimization/24689] New: store_ccp is missing an opportunity!? kazu at gcc dot gnu dot org
2005-11-06  4:34 ` [Bug tree-optimization/24689] store_ccp is missing an opportunity because of call clobber/alias load? pinskia at gcc dot gnu dot org
2005-11-06  4:47 ` pinskia at gcc dot gnu dot org
2005-11-06  4:50 ` [Bug tree-optimization/24689] store_ccp does nothing for array references pinskia at gcc dot gnu dot org
2005-11-06  4:53 ` pinskia at gcc dot gnu dot org
2006-01-15 21:35 ` pinskia at gcc dot gnu dot org
2006-01-16  6:02 ` [Bug tree-optimization/24689] operand_equal_p does not return true for some equivalent ARRAY_REF pinskia at gcc dot gnu dot org
2007-04-11 10:13 ` rguenth at gcc dot gnu dot org
2007-04-11 12:03 ` pinskia at gcc dot gnu dot org
2007-04-11 13:51 ` rguenth at gcc dot gnu dot org
2007-04-12  9:16 ` rguenth at gcc dot gnu dot org
2007-04-12  9:28 ` rguenth 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).