public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
@ 2009-01-06 21:32 rguenth at gcc dot gnu dot org
2009-01-06 21:33 ` [Bug tree-optimization/38748] " rguenth at gcc dot gnu dot org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-06 21:32 UTC (permalink / raw)
To: gcc-bugs
The load from *q should be CSEd but it isn't because tree forwprop introduces
a VIEW_CONVERT_EXPR from a load of p->f which conflicts with the store
through *r.
/* { dg-do "compile" } */
/* { dg-options "-O -fdump-tree-fre" } */
struct S { float f; };
int __attribute__((noinline))
foo (float *r, struct S *p)
{
int *q = (int *)&p->f;
int i = *q;
*r = 0.0;
return i + *q;
}
/* { dg-final { scan-tree-dump-times "\\\*q" 1 "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
--
Summary: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
@ 2009-01-06 21:33 ` rguenth at gcc dot gnu dot org
2009-01-11 14:29 ` rguenth at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-06 21:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-01-06 21:33 -------
Related to PR38747.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |38747
Known to work| |4.3.2
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
2009-01-06 21:33 ` [Bug tree-optimization/38748] " rguenth at gcc dot gnu dot org
@ 2009-01-11 14:29 ` rguenth at gcc dot gnu dot org
2009-01-11 14:41 ` 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 @ 2009-01-11 14:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2009-01-11 14:29 -------
This hits tramp3d a lot, we end up with
D.919534 = VIEW_CONVERT_EXPR<const struct
Loc>(D.919509.D.78313.D.78008).D.78313.D.78008.domain_m[0].D.77181.D.47055.D.46936.domain_m;
vs. D.919509.D.78313.D.78008...
the following fixes it:
Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c (revision 143251)
+++ gcc/tree-ssa-forwprop.c (working copy)
@@ -775,10 +775,13 @@ forward_propagate_addr_expr_1 (tree name
&& !TYPE_VOLATILE (TREE_TYPE (rhs))
&& !TYPE_VOLATILE (TREE_TYPE (TREE_OPERAND (def_rhs, 0)))
&& operand_equal_p (TYPE_SIZE (TREE_TYPE (rhs)),
- TYPE_SIZE (TREE_TYPE (TREE_OPERAND (def_rhs, 0))),
0))
+ TYPE_SIZE (TREE_TYPE (TREE_OPERAND (def_rhs, 0))), 0)
+ && (rhs2 = get_base_address (TREE_OPERAND (def_rhs, 0))) != NULL_TREE
+ && !INDIRECT_REF_P (rhs2))
{
tree new_rhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
new_rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (rhs), new_rhs);
+ STRIP_USELESS_TYPE_CONVERSION (new_rhs);
if (TREE_CODE (new_rhs) != VIEW_CONVERT_EXPR)
{
/* If we have folded the VIEW_CONVERT_EXPR then the result is only
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
2009-01-06 21:33 ` [Bug tree-optimization/38748] " rguenth at gcc dot gnu dot org
2009-01-11 14:29 ` rguenth at gcc dot gnu dot org
@ 2009-01-11 14:41 ` rguenth at gcc dot gnu dot org
2009-01-13 1:09 ` pinskia 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 @ 2009-01-11 14:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from rguenth at gcc dot gnu dot org 2009-01-11 14:41 -------
I can even see things like
SR.20836 = VIEW_CONVERT_EXPR<const struct Interval>(VIEW_CONVERT_EXPR<const
struct
Interval>(this->domain_m.D.115040.D.114739.domain_m[1].D.111565.D.45708.D.45522).D.45708.D.45522).D.45708.D.45522.domain_m[0];
in final cleanup :/
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-01-11 14:41 ` rguenth at gcc dot gnu dot org
@ 2009-01-13 1:09 ` pinskia at gcc dot gnu dot org
2009-01-13 8:55 ` rguenther at suse dot de
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-13 1:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2009-01-13 01:09 -------
We should be able to fold:
VIEW_CONVERT_EXPR<const struct Loc>(D.919509.D.78313.D.78008)
Into just D.919509 .
The indirect issue is a different one which needs to be fixed anyways as it
causes aliasing issues which were not in the original code in some cases.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pinskia at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-01-13 01:09:36
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-01-13 1:09 ` pinskia at gcc dot gnu dot org
@ 2009-01-13 8:55 ` rguenther at suse dot de
2009-01-15 15:55 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenther at suse dot de @ 2009-01-13 8:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from rguenther at suse dot de 2009-01-13 08:55 -------
Subject: Re: [4.4 Regression] Missed FRE because
of VIEW_CONVERT_EXPR
On Tue, 13 Jan 2009, pinskia at gcc dot gnu dot org wrote:
> ------- Comment #4 from pinskia at gcc dot gnu dot org 2009-01-13 01:09 -------
> We should be able to fold:
> VIEW_CONVERT_EXPR<const struct Loc>(D.919509.D.78313.D.78008)
>
> Into just D.919509 .
True. I tried a quick shot at it but it turns out to be slightly
complicated ;)
Richard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-01-13 8:55 ` rguenther at suse dot de
@ 2009-01-15 15:55 ` rguenth at gcc dot gnu dot org
2009-01-15 23:16 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-15 15:55 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-01-15 15:55 ` rguenth at gcc dot gnu dot org
@ 2009-01-15 23:16 ` pinskia at gcc dot gnu dot org
2009-01-15 23:30 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-15 23:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pinskia at gcc dot gnu dot org 2009-01-15 23:16 -------
The CSE of the load is only valid at -O2 and above (strict aliasing turned on).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
` (6 preceding siblings ...)
2009-01-15 23:16 ` pinskia at gcc dot gnu dot org
@ 2009-01-15 23:30 ` pinskia at gcc dot gnu dot org
2009-01-20 17:11 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-15 23:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2009-01-15 23:30 -------
PR 38747 has the best patch which allows most optimizations still but only
disabling it for the invalid cases when the aliasing sets are not equal.
Take:
struct S { unsigned f; };
int __attribute__((noinline))
foo ( struct S *p)
{
int *q = (int *)&p->f;
int i = *q;
return i + p->f;
}
We should be able to optimize this to just "tmp = p->f; return (int)(tmp +
tmp);" which we do with my patch unlike the one in comment #2 which disables
too many optimizations.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
` (7 preceding siblings ...)
2009-01-15 23:30 ` pinskia at gcc dot gnu dot org
@ 2009-01-20 17:11 ` rguenth at gcc dot gnu dot org
2009-01-20 17:11 ` rguenth at gcc dot gnu dot org
2009-01-30 17:32 ` hjl at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-20 17:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from rguenth at gcc dot gnu dot org 2009-01-20 17:10 -------
Subject: Bug 38748
Author: rguenth
Date: Tue Jan 20 17:10:40 2009
New Revision: 143523
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143523
Log:
2009-01-20 Andrew Pinski <andrew_pinski@playstation.sony.com>
Richard Guenther <rguenther@suse.de>
PR tree-optimization/38747
PR tree-optimization/38748
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Disable the VCE
conversion if the base address is an indirect reference and the
aliasing sets could cause issues.
* gcc.dg/tree-ssa/struct-aliasing-1.c: New test.
* gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise.
* gcc.c-torture/execute/struct-aliasing-1.c: Likewise.
Added:
trunk/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-forwprop.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
` (8 preceding siblings ...)
2009-01-20 17:11 ` rguenth at gcc dot gnu dot org
@ 2009-01-20 17:11 ` rguenth at gcc dot gnu dot org
2009-01-30 17:32 ` hjl at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-20 17:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from rguenth at gcc dot gnu dot org 2009-01-20 17:11 -------
Fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug tree-optimization/38748] [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
` (9 preceding siblings ...)
2009-01-20 17:11 ` rguenth at gcc dot gnu dot org
@ 2009-01-30 17:32 ` hjl at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: hjl at gcc dot gnu dot org @ 2009-01-30 17:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from hjl at gcc dot gnu dot org 2009-01-30 17:32 -------
Subject: Bug 38748
Author: hjl
Date: Fri Jan 30 17:31:24 2009
New Revision: 143798
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143798
Log:
2009-01-30 H.J. Lu <hongjiu.lu@intel.com>
2009-01-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38503
* g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C: New testcase.
2009-01-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/38745
* g++.dg/torture/pr38745.C: New testcase.
2009-01-26 Richard Guenther <rguenther@suse.de>
PR middle-end/38851
* g++.dg/warn/Wuninitialized-1.C: New testcase.
2009-01-20 Andrew Pinski <andrew_pinski@playstation.sony.com>
Richard Guenther <rguenther@suse.de>
PR tree-optimization/38747
PR tree-optimization/38748
* gcc.dg/tree-ssa/struct-aliasing-1.c: New test.
* gcc.c-torture/execute/struct-aliasing-1.c: Likewise.
Added:
branches/gcc-4_3-branch/gcc/testsuite/g++.dg/torture/pr38745.C
- copied unchanged from r143797,
trunk/gcc/testsuite/g++.dg/torture/pr38745.C
branches/gcc-4_3-branch/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C
- copied unchanged from r143797,
trunk/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C
branches/gcc-4_3-branch/gcc/testsuite/g++.dg/warn/Wuninitialized-1.C
- copied unchanged from r143797,
trunk/gcc/testsuite/g++.dg/warn/Wuninitialized-1.C
branches/gcc-4_3-branch/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c
- copied unchanged from r143797,
trunk/gcc/testsuite/gcc.c-torture/execute/struct-aliasing-1.c
branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
- copied unchanged from r143797,
trunk/gcc/testsuite/gcc.dg/tree-ssa/struct-aliasing-1.c
Modified:
branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-01-30 17:32 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-06 21:32 [Bug tree-optimization/38748] New: [4.4 Regression] Missed FRE because of VIEW_CONVERT_EXPR rguenth at gcc dot gnu dot org
2009-01-06 21:33 ` [Bug tree-optimization/38748] " rguenth at gcc dot gnu dot org
2009-01-11 14:29 ` rguenth at gcc dot gnu dot org
2009-01-11 14:41 ` rguenth at gcc dot gnu dot org
2009-01-13 1:09 ` pinskia at gcc dot gnu dot org
2009-01-13 8:55 ` rguenther at suse dot de
2009-01-15 15:55 ` rguenth at gcc dot gnu dot org
2009-01-15 23:16 ` pinskia at gcc dot gnu dot org
2009-01-15 23:30 ` pinskia at gcc dot gnu dot org
2009-01-20 17:11 ` rguenth at gcc dot gnu dot org
2009-01-20 17:11 ` rguenth at gcc dot gnu dot org
2009-01-30 17:32 ` hjl 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).