public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/15743] New: Fold index() at tree level.
@ 2004-05-31 22:01 kazu at cs dot umass dot edu
2004-05-31 22:08 ` [Bug tree-optimization/15743] " kazu at cs dot umass dot edu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-31 22:01 UTC (permalink / raw)
To: gcc-bugs
char *
foo (void)
{
const char *s = "abcd";
int c = 'p';
return index (s, c);
}
I get:
foo ()
{
int c;
const char * s;
char * T.0;
<bb 0>:
T.0_3 = index ("abcd", 112) [tail call];
return T.0_3;
}
The fix is pretty easy.
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.328
diff -u -r1.328 builtins.c
--- builtins.c 30 May 2004 21:05:20 -0000 1.328
+++ builtins.c 31 May 2004 06:44:31 -0000
@@ -7837,6 +7837,7 @@
case BUILT_IN_STRNCPY:
return fold_builtin_strncpy (exp);
+ case BUILT_IN_INDEX:
case BUILT_IN_STRCHR:
return fold_builtin_strchr (exp, false);
I'll post the patch to gcc-patches after testing it.
--
Summary: Fold index() at tree level.
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Keywords: missed-optimization
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=15743
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/15743] Fold index() at tree level.
2004-05-31 22:01 [Bug tree-optimization/15743] New: Fold index() at tree level kazu at cs dot umass dot edu
@ 2004-05-31 22:08 ` kazu at cs dot umass dot edu
2004-05-31 22:23 ` pinskia at gcc dot gnu dot org
2004-05-31 22:29 ` kazu at cs dot umass dot edu
2 siblings, 0 replies; 4+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-31 22:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-05-31 09:26 -------
The above deficiency also applies to rindex().
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15743
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/15743] Fold index() at tree level.
2004-05-31 22:01 [Bug tree-optimization/15743] New: Fold index() at tree level kazu at cs dot umass dot edu
2004-05-31 22:08 ` [Bug tree-optimization/15743] " kazu at cs dot umass dot edu
@ 2004-05-31 22:23 ` pinskia at gcc dot gnu dot org
2004-05-31 22:29 ` kazu at cs dot umass dot edu
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-31 22:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-31 13:11 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2004-05-31 13:11:47
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15743
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug tree-optimization/15743] Fold index() at tree level.
2004-05-31 22:01 [Bug tree-optimization/15743] New: Fold index() at tree level kazu at cs dot umass dot edu
2004-05-31 22:08 ` [Bug tree-optimization/15743] " kazu at cs dot umass dot edu
2004-05-31 22:23 ` pinskia at gcc dot gnu dot org
@ 2004-05-31 22:29 ` kazu at cs dot umass dot edu
2 siblings, 0 replies; 4+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-31 22:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-05-31 13:18 -------
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=15743
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-05-31 13:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-31 22:01 [Bug tree-optimization/15743] New: Fold index() at tree level kazu at cs dot umass dot edu
2004-05-31 22:08 ` [Bug tree-optimization/15743] " kazu at cs dot umass dot edu
2004-05-31 22:23 ` pinskia at gcc dot gnu dot org
2004-05-31 22:29 ` 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).