public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/15738] New: [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0
@ 2004-05-31 21:04 kazu at cs dot umass dot edu
  2004-05-31 21:04 ` [Bug tree-optimization/15738] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-31 21:04 UTC (permalink / raw)
  To: gcc-bugs

char *
foo (const char *s)
{
  int c = 0;
  return strrchr (s, c);
}

I get:

foo (s)
{
  int c;
  char * T.0;

<bb 0>:
  T.0_3 = strrchr (s_2, 0) [tail call];
  return T.0_3;

}

If you write "strrchr (s, 0)" in the first place,
then you get "strchr (s, 0)" with the help of simplify_builtin().

Once this optimization is done, I think we can remove
expand_builtin_strchr and expand_builtin_strrchr.

-- 
           Summary: [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is
                    known to be 0
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2004-06-04  6:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-31 21:04 [Bug tree-optimization/15738] New: [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0 kazu at cs dot umass dot edu
2004-05-31 21:04 ` [Bug tree-optimization/15738] " pinskia at gcc dot gnu dot org
2004-05-31 22:38 ` kazu at cs dot umass dot edu
2004-06-01  5:29 ` kazu at cs dot umass dot edu
2004-06-02 18:41 ` cvs-commit at gcc dot gnu dot org
2004-06-02 18:44 ` kazu at cs dot umass dot edu
2004-06-04  6:23 ` 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).