public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level
@ 2004-04-02 6:00 kazu at cs dot umass dot edu
2004-04-02 6:03 ` [Bug optimization/14819] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-02 6:00 UTC (permalink / raw)
To: gcc-bugs
Consider:
extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));
int
foo (void)
{
int c = '1';
return (strchr ("<12ers", c) == 0);
}
Here is the last tree form.
foo ()
{
<bb 0>:
return strchr ("<12ers", 49) == 0B;
}
This strchr seems to be optimized at expand time.
As you might guess from the above testcase, GCC has a lot of redundant
IS_EXPR_CODE_CLASS(CLASS), where CLASS is a compile-time constant.
Optimizing these strchr away in turn allows us to remove a lot of dead code.
It seems to be a simple extension to call simplify_builtin_strchr() from
tree-ssa-ccp.c.
--
Summary: [tree-ssa] strchr is not folded at tree-level
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: enhancement
Priority: P2
Component: 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=14819
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/14819] [tree-ssa] strchr is not folded at tree-level
2004-04-02 6:00 [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level kazu at cs dot umass dot edu
@ 2004-04-02 6:03 ` pinskia at gcc dot gnu dot org
2004-04-02 6:18 ` kazu at cs dot umass dot edu
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-02 6:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-02 06:03 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-04-02 06:03:04
date| |
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14819
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/14819] [tree-ssa] strchr is not folded at tree-level
2004-04-02 6:00 [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level kazu at cs dot umass dot edu
2004-04-02 6:03 ` [Bug optimization/14819] " pinskia at gcc dot gnu dot org
@ 2004-04-02 6:18 ` kazu at cs dot umass dot edu
2004-04-02 14:10 ` steven at gcc dot gnu dot org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-04-02 6:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-04-02 06:18 -------
Another possible place for this optimization would be fold_builtin().
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14819
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug optimization/14819] [tree-ssa] strchr is not folded at tree-level
2004-04-02 6:00 [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level kazu at cs dot umass dot edu
2004-04-02 6:03 ` [Bug optimization/14819] " pinskia at gcc dot gnu dot org
2004-04-02 6:18 ` kazu at cs dot umass dot edu
@ 2004-04-02 14:10 ` steven at gcc dot gnu dot org
2004-05-21 19:44 ` [Bug tree-optimization/14819] " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-04-02 14:10 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From steven at gcc dot gnu dot org 2004-04-02 14:10 -------
This should be folded in ccp. Mind if I make this my weekend project?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Last reconfirmed|2004-04-02 06:03:04 |2004-04-02 14:10:29
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14819
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/14819] [tree-ssa] strchr is not folded at tree-level
2004-04-02 6:00 [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level kazu at cs dot umass dot edu
` (2 preceding siblings ...)
2004-04-02 14:10 ` steven at gcc dot gnu dot org
@ 2004-05-21 19:44 ` pinskia at gcc dot gnu dot org
2004-05-24 19:18 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-21 19:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-20 19:44 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-05/msg01275.html>.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14819
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/14819] [tree-ssa] strchr is not folded at tree-level
2004-04-02 6:00 [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level kazu at cs dot umass dot edu
` (3 preceding siblings ...)
2004-05-21 19:44 ` [Bug tree-optimization/14819] " pinskia at gcc dot gnu dot org
@ 2004-05-24 19:18 ` pinskia at gcc dot gnu dot org
2004-05-31 21:01 ` cvs-commit at gcc dot gnu dot org
2004-05-31 21:04 ` kazu at cs dot umass dot edu
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 19:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-24 01:22 -------
The patch was approved with the modification suggested by RTH.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14819
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/14819] [tree-ssa] strchr is not folded at tree-level
2004-04-02 6:00 [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level kazu at cs dot umass dot edu
` (4 preceding siblings ...)
2004-05-24 19:18 ` pinskia at gcc dot gnu dot org
@ 2004-05-31 21:01 ` cvs-commit at gcc dot gnu dot org
2004-05-31 21:04 ` kazu at cs dot umass dot edu
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-31 21:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-05-30 21:05 -------
Subject: Bug 14819
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: kazu@gcc.gnu.org 2004-05-30 21:05:21
Modified files:
gcc : ChangeLog builtins.c
Log message:
PR tree-optimization/14819
* builtins.c (fold_builtin_strchr): New.
(fold_builtin_1): Handle BUILT_IN_STRCHR and BUILT_IN_STRRCHR
with fold_builtin_strchr().
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3792&r2=2.3793
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&r1=1.327&r2=1.328
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14819
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug tree-optimization/14819] [tree-ssa] strchr is not folded at tree-level
2004-04-02 6:00 [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level kazu at cs dot umass dot edu
` (5 preceding siblings ...)
2004-05-31 21:01 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-31 21:04 ` kazu at cs dot umass dot edu
6 siblings, 0 replies; 8+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-31 21:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-05-30 21:07 -------
Just checked in a patch:
http://gcc.gnu.org/ml/gcc-cvs/2004-05/msg01066.html
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14819
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-05-30 21:07 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-02 6:00 [Bug optimization/14819] New: [tree-ssa] strchr is not folded at tree-level kazu at cs dot umass dot edu
2004-04-02 6:03 ` [Bug optimization/14819] " pinskia at gcc dot gnu dot org
2004-04-02 6:18 ` kazu at cs dot umass dot edu
2004-04-02 14:10 ` steven at gcc dot gnu dot org
2004-05-21 19:44 ` [Bug tree-optimization/14819] " pinskia at gcc dot gnu dot org
2004-05-24 19:18 ` pinskia at gcc dot gnu dot org
2004-05-31 21:01 ` cvs-commit at gcc dot gnu dot org
2004-05-31 21:04 ` kazu at cs dot umass dot edu
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).