public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15347] New: [tree-ssa] fold if ("<12ers" + 1 == 0).
@ 2004-05-09 19:25 kazu at cs dot umass dot edu
2004-05-09 19:41 ` [Bug optimization/15347] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 16+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-09 19:25 UTC (permalink / raw)
To: gcc-bugs
void bar ();
int
foo (void)
{
if ("<12ers" + 1 == 0)
bar ();
}
which is reduced from from
extern const char tree_code_type[];
extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));
extern void abort (void) __attribute__ ((__noreturn__));
int
foo (int a)
{
if (tree_code_type[a] == '1')
if (strchr ("<12ers", tree_code_type[a]) == 0)
abort ();
}
which is in turn reduced from find_base_decl() in alias.c.
--
Summary: [tree-ssa] fold if ("<12ers" + 1 == 0).
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: normal
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=15347
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
2004-05-09 19:25 [Bug optimization/15347] New: [tree-ssa] fold if ("<12ers" + 1 == 0) kazu at cs dot umass dot edu
@ 2004-05-09 19:41 ` pinskia at gcc dot gnu dot org
2004-05-09 20:15 ` kazu at cs dot umass dot edu
` (5 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-09 19:41 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-09 19:41 -------
I think the two test cases are not related at all, the second one only needs to fold strchr ("<12ers", '1' )
to 1 (which it does when expanding to RTL). There are two problems with the first testcase, first
"<12ers" + 1 == 0 is "folded" to "<12ers" == -1 by fold, and but if you add a tempary variable then "<
12ers" + 1 == 0 is not folded to false. Confirmed otherwise, the orginal testcase is not done on the
RTL level but the other two are.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |TREE
Last reconfirmed|0000-00-00 00:00:00 |2004-05-09 19:41:05
date| |
Target Milestone|--- |tree-ssa
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15347
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
2004-05-09 19:25 [Bug optimization/15347] New: [tree-ssa] fold if ("<12ers" + 1 == 0) kazu at cs dot umass dot edu
2004-05-09 19:41 ` [Bug optimization/15347] " pinskia at gcc dot gnu dot org
@ 2004-05-09 20:15 ` kazu at cs dot umass dot edu
2004-05-09 20:22 ` kazu at cs dot umass dot edu
` (4 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-09 20:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-05-09 20:15 -------
Andrew, I forgot to say that the first testcase can be obtained more or less
if you use Steven's strchr optimization patch.
IIRC, His strchr optimization happens in CCP, so
fold does not get to fold "<12ers" + 1 == 0 into false.
In any case, all the stupidity in this area should go away.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15347
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
2004-05-09 19:25 [Bug optimization/15347] New: [tree-ssa] fold if ("<12ers" + 1 == 0) kazu at cs dot umass dot edu
2004-05-09 19:41 ` [Bug optimization/15347] " pinskia at gcc dot gnu dot org
2004-05-09 20:15 ` kazu at cs dot umass dot edu
@ 2004-05-09 20:22 ` kazu at cs dot umass dot edu
2004-05-24 22:29 ` [Bug tree-optimization/15347] " pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-05-09 20:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-05-09 20:22 -------
See also PR 14819.
If strchr() is folded to NULL, we don't have to worry about anything.
Otherwise, resolution of this PR is important.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15347
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
2004-05-09 19:25 [Bug optimization/15347] New: [tree-ssa] fold if ("<12ers" + 1 == 0) kazu at cs dot umass dot edu
` (2 preceding siblings ...)
2004-05-09 20:22 ` kazu at cs dot umass dot edu
@ 2004-05-24 22:29 ` pinskia at gcc dot gnu dot org
2004-06-01 6:45 ` kazu at cs dot umass dot edu
` (2 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-24 22:29 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.5.0 |---
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15347
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
2004-05-09 19:25 [Bug optimization/15347] New: [tree-ssa] fold if ("<12ers" + 1 == 0) kazu at cs dot umass dot edu
` (3 preceding siblings ...)
2004-05-24 22:29 ` [Bug tree-optimization/15347] " pinskia at gcc dot gnu dot org
@ 2004-06-01 6:45 ` kazu at cs dot umass dot edu
2004-06-01 6:48 ` kazu at cs dot umass dot edu
2004-06-03 23:22 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 16+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-06-01 6:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-06-01 06:45 -------
Now that Steven's strchr patch is in, let me reiterate the problem.
void bar (void);
void
foo (void)
{
int c = '1';
if (strchr ("<12ers", c) == 0)
bar ();
}
void
baz (void)
{
int c = '1';
if ("<12ers" + 1 == 0)
bar ();
}
The last tree-ssa form looks like:
;; Function foo (foo)
foo ()
{
int c;
char * T.0;
<bb 0>:
T.0_2 = "<12ers" + 1B;
if (T.0_2 == 0B) goto <L0>; else goto <L1>;
<L0>:;
bar () [tail call];
<L1>:;
return;
}
;; Function baz (baz)
baz ()
{
int c;
<bb 0>:
if ("<12ers" == -1B) goto <L0>; else goto <L1>;
<L0>:;
bar () [tail call];
<L1>:;
return;
}
In either case, we miss the folding opportunity.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15347
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
2004-05-09 19:25 [Bug optimization/15347] New: [tree-ssa] fold if ("<12ers" + 1 == 0) kazu at cs dot umass dot edu
` (4 preceding siblings ...)
2004-06-01 6:45 ` kazu at cs dot umass dot edu
@ 2004-06-01 6:48 ` kazu at cs dot umass dot edu
2004-06-03 23:22 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 16+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-06-01 6:48 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2004-06-01 06:47 -------
"int c = '1';" in baz() in comment #4 is an unintended garbage.
Please ignore it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15347
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug tree-optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
2004-05-09 19:25 [Bug optimization/15347] New: [tree-ssa] fold if ("<12ers" + 1 == 0) kazu at cs dot umass dot edu
` (5 preceding siblings ...)
2004-06-01 6:48 ` kazu at cs dot umass dot edu
@ 2004-06-03 23:22 ` pinskia at gcc dot gnu dot org
6 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-03 23:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-03 23:22 -------
I should note that "12ers" == 0 is folded to false by:
/* If this is an equality comparison of the address of a non-weak
object against zero, then we know the result. */
So improving that part will help.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15347
^ permalink raw reply [flat|nested] 16+ messages in thread
[parent not found: <bug-15347-5009@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-15347-4@http.gcc.gnu.org/bugzilla/>]
end of thread, other threads:[~2014-10-31 4:02 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-09 19:25 [Bug optimization/15347] New: [tree-ssa] fold if ("<12ers" + 1 == 0) kazu at cs dot umass dot edu
2004-05-09 19:41 ` [Bug optimization/15347] " pinskia at gcc dot gnu dot org
2004-05-09 20:15 ` kazu at cs dot umass dot edu
2004-05-09 20:22 ` kazu at cs dot umass dot edu
2004-05-24 22:29 ` [Bug tree-optimization/15347] " pinskia at gcc dot gnu dot org
2004-06-01 6:45 ` kazu at cs dot umass dot edu
2004-06-01 6:48 ` kazu at cs dot umass dot edu
2004-06-03 23:22 ` pinskia at gcc dot gnu dot org
[not found] <bug-15347-5009@http.gcc.gnu.org/bugzilla/>
2005-12-07 3:23 ` pinskia at gcc dot gnu dot org
2006-09-17 8:44 ` pinskia at gcc dot gnu dot org
[not found] <bug-15347-4@http.gcc.gnu.org/bugzilla/>
2011-04-27 17:54 ` matt at use dot net
2011-04-27 18:32 ` hjl.tools at gmail dot com
2011-04-28 9:59 ` rguenth at gcc dot gnu.org
2011-04-28 10:02 ` rguenth at gcc dot gnu.org
2011-04-28 10:05 ` rguenth at gcc dot gnu.org
2014-10-31 4:02 ` pinskia at gcc dot gnu.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).