public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/27799] New: adding unused char field inhibits optimization
@ 2006-05-29 17:49 dann at godzilla dot ics dot uci dot edu
2006-05-29 18:50 ` [Bug tree-optimization/27799] " pinskia at gcc dot gnu dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2006-05-29 17:49 UTC (permalink / raw)
To: gcc-bugs
For this code:
struct X {double m; int x;};
struct Y {int y; short d;};
struct YY {int y; short d; char c;};
int foo(struct X *x, struct Y *y)
{
x->x = 0;
y->y = 1;
if (x->x != 0)
abort ();
}
int foo_no(struct X *x, struct YY *y)
{
x->x = 0;
y->y = 1;
if (x->x != 0)
abort ();
}
the "if" does not get optimized away (by the dom1 pass) for the "foo_no"
function, but it is optimized for "foo"
The only difference between the 2 functions is that foo_no takes as a parameter
a pointer to a struct that has a "char" field that is not accessed in this
function.
It would be nice if both functions were optimized in the same way.
--
Summary: adding unused char field inhibits optimization
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
@ 2006-05-29 18:50 ` pinskia at gcc dot gnu dot org
2006-05-30 12:41 ` rguenth at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-29 18:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-05-29 18:50 -------
Confirmed, the problem is that char is recognized as something which can alias
anything which is why it is not optimized.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2006-05-29 18:50:17
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
2006-05-29 18:50 ` [Bug tree-optimization/27799] " pinskia at gcc dot gnu dot org
@ 2006-05-30 12:41 ` rguenth at gcc dot gnu dot org
2008-03-04 20:36 ` rguenth at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-05-30 12:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2006-05-30 12:41 -------
Variable: x, UID 1535, struct X *, symbol memory tag: SMT.4, default def: x_1
Variable: y, UID 1536, struct YY *, symbol memory tag: SMT.5, default def: y_2
Variable: SMT.4, UID 1549, struct X, is addressable, is global, call clobbered
(, is global var, is incoming pointer ), may aliases: { SMT.5 }
but this aliasing cannot really happen.
Flow-insensitive alias information for foo_no
Aliased symbols
SMT.5, UID 1550, struct YY, is aliased, is addressable, is global, call
clobbered (, is global var, is incoming pointer )
SMT.4, UID 1549, struct X, is addressable, is global, call clobbered (, is
global var, is incoming pointer ), may aliases: { SMT.5 }
record_component_aliases is likely too conservative here.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dberlin at gcc dot gnu dot
| |org
GCC target triplet|i686-pc-linux-gnu |
Keywords| |alias
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
2006-05-29 18:50 ` [Bug tree-optimization/27799] " pinskia at gcc dot gnu dot org
2006-05-30 12:41 ` rguenth at gcc dot gnu dot org
@ 2008-03-04 20:36 ` rguenth at gcc dot gnu dot org
2008-03-04 21:00 ` rguenth at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-04 20:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2008-03-04 20:35 -------
Actually alias_sets_conflict_p is the cuplrit, as we have in the alias subset
of struct YY alias set zero (entered for the char member, accesses conflict
with accesses through char *):
/* See if the first alias set is a subset of the second. */
ase = get_alias_set_entry (set1);
if (ase != 0
&& (ase->has_zero_child
|| splay_tree_lookup (ase->children,
(splay_tree_key) set2)))
return 1;
which IMHO should do
if (ase != 0
&& ((ase->has_zero_child && set2 == 0)
|| splay_tree_lookup (ase->children, (splay_tree_key) set2))
return 1;
where then both cases are optimized?
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dnovillo at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
` (2 preceding siblings ...)
2008-03-04 20:36 ` rguenth at gcc dot gnu dot org
@ 2008-03-04 21:00 ` rguenth at gcc dot gnu dot org
2008-03-04 21:20 ` dann at godzilla dot ics dot uci dot edu
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-04 21:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2008-03-04 21:00 -------
http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00243.html
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2006-05-29 18:50:17 |2008-03-04 21:00:03
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
` (3 preceding siblings ...)
2008-03-04 21:00 ` rguenth at gcc dot gnu dot org
@ 2008-03-04 21:20 ` dann at godzilla dot ics dot uci dot edu
2008-03-04 21:23 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2008-03-04 21:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dann at godzilla dot ics dot uci dot edu 2008-03-04 21:19 -------
(In reply to comment #4)
> http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00243.html
Thanks for working on this!
Have you looked at the impact?
Probably the generated code won't too different because the RTL alias analysis
probably catches this.
But it would be interesting to see what is the difference for the tree dumps
before and after this patch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
` (4 preceding siblings ...)
2008-03-04 21:20 ` dann at godzilla dot ics dot uci dot edu
@ 2008-03-04 21:23 ` rguenth at gcc dot gnu dot org
2008-03-04 21:33 ` dann at godzilla dot ics dot uci dot edu
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-04 21:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from rguenth at gcc dot gnu dot org 2008-03-04 21:22 -------
Actually RTL alias is just using the same routines. The IL difference is
# SMT.4_6 = VDEF <SMT.4_4(D)>
# SMT.5_7 = VDEF <SMT.5_5(D)>
x_1(D)->x = 0;
# SMT.5_8 = VDEF <SMT.5_7>
y_2(D)->y = 1;
vs.
# SMT.18_5 = VDEF <SMT.18_4(D)>
x_1(D)->x = 0;
# SMT.19_7 = VDEF <SMT.19_6(D)>
y_2(D)->y = 1;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
` (5 preceding siblings ...)
2008-03-04 21:23 ` rguenth at gcc dot gnu dot org
@ 2008-03-04 21:33 ` dann at godzilla dot ics dot uci dot edu
2008-03-04 21:35 ` rguenther at suse dot de
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2008-03-04 21:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from dann at godzilla dot ics dot uci dot edu 2008-03-04 21:32 -------
(In reply to comment #6)
> Actually RTL alias is just using the same routines.
Might be, but the RTL level code that optimizes away the abort() in both
testcases (if I remember well nonoverlapping_component_refs_p).
>
> # SMT.4_6 = VDEF <SMT.4_4(D)>
> # SMT.5_7 = VDEF <SMT.5_5(D)>
> x_1(D)->x = 0;
> # SMT.5_8 = VDEF <SMT.5_7>
> y_2(D)->y = 1;
>
> vs.
>
> # SMT.18_5 = VDEF <SMT.18_4(D)>
> x_1(D)->x = 0;
> # SMT.19_7 = VDEF <SMT.19_6(D)>
> y_2(D)->y = 1;
That is for this testcase, but what about the impact on .final_cleanup for
something big like combine.c?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
` (6 preceding siblings ...)
2008-03-04 21:33 ` dann at godzilla dot ics dot uci dot edu
@ 2008-03-04 21:35 ` rguenther at suse dot de
2008-03-04 21:43 ` dann at godzilla dot ics dot uci dot edu
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenther at suse dot de @ 2008-03-04 21:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from rguenther at suse dot de 2008-03-04 21:35 -------
Subject: Re: adding unused char field inhibits
optimization
On Tue, 4 Mar 2008, dann at godzilla dot ics dot uci dot edu wrote:
> ------- Comment #7 from dann at godzilla dot ics dot uci dot edu 2008-03-04 21:32 -------
> (In reply to comment #6)
> > Actually RTL alias is just using the same routines.
> Might be, but the RTL level code that optimizes away the abort() in both
> testcases (if I remember well nonoverlapping_component_refs_p).
I still have the abort () with -O2.
> >
> > # SMT.4_6 = VDEF <SMT.4_4(D)>
> > # SMT.5_7 = VDEF <SMT.5_5(D)>
> > x_1(D)->x = 0;
> > # SMT.5_8 = VDEF <SMT.5_7>
> > y_2(D)->y = 1;
> >
> > vs.
> >
> > # SMT.18_5 = VDEF <SMT.18_4(D)>
> > x_1(D)->x = 0;
> > # SMT.19_7 = VDEF <SMT.19_6(D)>
> > y_2(D)->y = 1;
>
> That is for this testcase, but what about the impact on .final_cleanup for
> something big like combine.c?
No idea, but feel free to check.
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
` (7 preceding siblings ...)
2008-03-04 21:35 ` rguenther at suse dot de
@ 2008-03-04 21:43 ` dann at godzilla dot ics dot uci dot edu
2008-04-23 14:10 ` rguenth at gcc dot gnu dot org
2008-04-23 14:10 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2008-03-04 21:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from dann at godzilla dot ics dot uci dot edu 2008-03-04 21:43 -------
(In reply to comment #8)
> Subject: Re: adding unused char field inhibits
> optimization
>
> On Tue, 4 Mar 2008, dann at godzilla dot ics dot uci dot edu wrote:
>
> > ------- Comment #7 from dann at godzilla dot ics dot uci dot edu 2008-03-04 21:32 -------
> > (In reply to comment #6)
> > > Actually RTL alias is just using the same routines.
> > Might be, but the RTL level code that optimizes away the abort() in both
> > testcases (if I remember well nonoverlapping_component_refs_p).
>
> I still have the abort () with -O2.
Argghh, sorry, my bad: typo in the "grep abort file.s" command ...
> > That is for this testcase, but what about the impact on .final_cleanup for
> > something big like combine.c?
>
> No idea, but feel free to check.
I don't have a recent build...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
` (8 preceding siblings ...)
2008-03-04 21:43 ` dann at godzilla dot ics dot uci dot edu
@ 2008-04-23 14:10 ` rguenth at gcc dot gnu dot org
2008-04-23 14:10 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-23 14:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2008-04-23 14:09 -------
Subject: Bug 27799
Author: rguenth
Date: Wed Apr 23 14:08:25 2008
New Revision: 134598
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134598
Log:
2008-04-23 Richard Guenther <rguenther@suse.de>
PR tree-optimization/27799
PR tree-optimization/32921
PR tree-optimization/32624
* tree-ssa-structalias.c (merge_smts_into): Only merge the
SMTs aliases and the tag itself into the solution.
* tree-ssa-alias.c (compute_flow_sensitive_aliasing): Do not
merge the points-to solution back into the SMT aliases.
(may_alias_p): Use alias_set_subset_of instead of
aliases_conflict_p. A pointer which points to
memory with alias set zero may access any variable.
* gcc.dg/tree-ssa/pr27799.c: New testcase.
* gcc.dg/tree-ssa/20030807-7.c: Remove xfail, scan vrp dump.
Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr27799.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
trunk/gcc/tree-ssa-alias.c
trunk/gcc/tree-ssa-structalias.c
------- Comment #11 from rguenth at gcc dot gnu dot org 2008-04-23 14:09 -------
Fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/27799] adding unused char field inhibits optimization
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
` (9 preceding siblings ...)
2008-04-23 14:10 ` rguenth at gcc dot gnu dot org
@ 2008-04-23 14:10 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-04-23 14:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2008-04-23 14:09 -------
Subject: Bug 27799
Author: rguenth
Date: Wed Apr 23 14:08:25 2008
New Revision: 134598
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134598
Log:
2008-04-23 Richard Guenther <rguenther@suse.de>
PR tree-optimization/27799
PR tree-optimization/32921
PR tree-optimization/32624
* tree-ssa-structalias.c (merge_smts_into): Only merge the
SMTs aliases and the tag itself into the solution.
* tree-ssa-alias.c (compute_flow_sensitive_aliasing): Do not
merge the points-to solution back into the SMT aliases.
(may_alias_p): Use alias_set_subset_of instead of
aliases_conflict_p. A pointer which points to
memory with alias set zero may access any variable.
* gcc.dg/tree-ssa/pr27799.c: New testcase.
* gcc.dg/tree-ssa/20030807-7.c: Remove xfail, scan vrp dump.
Added:
trunk/gcc/testsuite/gcc.dg/tree-ssa/pr27799.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/tree-ssa/20030807-7.c
trunk/gcc/tree-ssa-alias.c
trunk/gcc/tree-ssa-structalias.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27799
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-04-23 14:10 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-29 17:49 [Bug tree-optimization/27799] New: adding unused char field inhibits optimization dann at godzilla dot ics dot uci dot edu
2006-05-29 18:50 ` [Bug tree-optimization/27799] " pinskia at gcc dot gnu dot org
2006-05-30 12:41 ` rguenth at gcc dot gnu dot org
2008-03-04 20:36 ` rguenth at gcc dot gnu dot org
2008-03-04 21:00 ` rguenth at gcc dot gnu dot org
2008-03-04 21:20 ` dann at godzilla dot ics dot uci dot edu
2008-03-04 21:23 ` rguenth at gcc dot gnu dot org
2008-03-04 21:33 ` dann at godzilla dot ics dot uci dot edu
2008-03-04 21:35 ` rguenther at suse dot de
2008-03-04 21:43 ` dann at godzilla dot ics dot uci dot edu
2008-04-23 14:10 ` rguenth at gcc dot gnu dot org
2008-04-23 14:10 ` rguenth 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).