This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/15738] New: [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0
- From: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 May 2004 21:45:50 -0000
- Subject: [Bug tree-optimization/15738] New: [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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