This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/15738] New: [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]