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
* [Bug tree-optimization/15738] [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0
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 ` pinskia at gcc dot gnu dot org
2004-05-31 22:38 ` kazu at cs dot umass dot edu
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-31 21:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-30 21:49 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2004-05-30 21:49:28
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15738
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/15738] [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0
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
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-31 22:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-05-31 13:21 -------
I've got a patch in testing.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |kazu at cs dot umass dot edu
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15738
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/15738] [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0
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
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-06-01 5:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-06-01 05:29 -------
A patch:
http://gcc.gnu.org/ml/gcc-patches/2004-06/msg00009.html
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15738
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/15738] [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0
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
` (2 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-06-02 18:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-06-02 18:41 -------
Subject: Bug 15738
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: kazu@gcc.gnu.org 2004-06-02 18:41:41
Modified files:
gcc : ChangeLog builtins.c
Log message:
PR tree-optimization/15738.
* builtins.c (fold_builtin_strchr): Transform
strrchr (s, '\0') to strchr (s, '\0').
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3821&r2=2.3822
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&r1=1.330&r2=1.331
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15738
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/15738] [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0
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
` (3 preceding siblings ...)
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
5 siblings, 0 replies; 7+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-06-02 18:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-06-02 18:44 -------
Just checked in a patch.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15738
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/15738] [tree-ssa] Convert strrchr(s, c) to strchr(s, c) if c is known to be 0
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
` (4 preceding siblings ...)
2004-06-02 18:44 ` kazu at cs dot umass dot edu
@ 2004-06-04 6:23 ` pinskia at gcc dot gnu dot org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-04 6:23 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |3.5.0
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).