public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/67666] New: single restrict pointer in struct looses restrict
@ 2015-09-21 10:05 vries at gcc dot gnu.org
2015-09-21 10:54 ` [Bug tree-optimization/67666] " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2015-09-21 10:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67666
Bug ID: 67666
Summary: single restrict pointer in struct looses restrict
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
Consider testcase test.c:
...
struct ps
{
int *__restrict__ p;
};
void
f (struct ps &__restrict__ ps1)
{
*(ps1.p) = 1;
}
...
Compile the test-case with g++ -O2, and we get one clique/base annotation at
ealias (the one for ps1, not the one for p):
...
void f(ps&) (struct psD.2252 & restrict ps1D.2255)
{
intD.9 * _3;
# VUSE <.MEM_1(D)>
# PT = nonlocal escaped
_3 = MEM[(struct psD.2252 &)ps1_2(D) clique 1 base 1].pD.2254;
# .MEM_4 = VDEF <.MEM_1(D)>
*_3 = 1;
...
After applying the patch:
...
--- test7.c.orig 2015-09-21 11:38:30.607225802 +0200
+++ test7.c 2015-09-21 11:29:40.891234983 +0200
@@ -1,6 +1,7 @@
struct ps
{
int *__restrict__ p;
+ int a;
};
void
...
we get both clique/base annotations at ealias:
...
void f(ps&) (struct psD.2252 & restrict ps1D.2256)
{
intD.9 * _3;
# VUSE <.MEM_1(D)>
# PT = { D.2263 } (nonlocal)
_3 = MEM[(struct psD.2252 &)ps1_2(D) clique 1 base 1].pD.2254;
# .MEM_4 = VDEF <.MEM_1(D)>
MEM[(intD.9 *)_3 clique 1 base 2] = 1;
# VUSE <.MEM_4>
...
Using this demonstrator patch, I manage to get both clique/base annotations at
ealias, without adding an 'int a' field to the struct:
...
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index b5b9d0a..e99feeb 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -5675,8 +5675,7 @@ create_variable_info_for_1 (tree decl, const char *name)
/* If we didn't end up collecting sub-variables create a full
variable for the decl. */
- if (fieldstack.length () <= 1
- || fieldstack.length () > MAX_FIELDS_FOR_FIELD_SENSITIVE)
+ if (fieldstack.length () > MAX_FIELDS_FOR_FIELD_SENSITIVE)
{
vi = new_var_info (decl, name);
vi->offset = 0;
...
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/67666] single restrict pointer in struct looses restrict
2015-09-21 10:05 [Bug tree-optimization/67666] New: single restrict pointer in struct looses restrict vries at gcc dot gnu.org
@ 2015-09-21 10:54 ` rguenth at gcc dot gnu.org
2015-09-22 7:02 ` vries at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-09-21 10:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67666
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Looks good to me. The other possibility is to init ->only_restrict_pointers
from
the single entry.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/67666] single restrict pointer in struct looses restrict
2015-09-21 10:05 [Bug tree-optimization/67666] New: single restrict pointer in struct looses restrict vries at gcc dot gnu.org
2015-09-21 10:54 ` [Bug tree-optimization/67666] " rguenth at gcc dot gnu.org
@ 2015-09-22 7:02 ` vries at gcc dot gnu.org
2015-09-22 8:16 ` vries at gcc dot gnu.org
2015-09-22 8:16 ` vries at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2015-09-22 7:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67666
vries at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
--- Comment #3 from vries at gcc dot gnu.org ---
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg01622.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/67666] single restrict pointer in struct looses restrict
2015-09-21 10:05 [Bug tree-optimization/67666] New: single restrict pointer in struct looses restrict vries at gcc dot gnu.org
` (2 preceding siblings ...)
2015-09-22 8:16 ` vries at gcc dot gnu.org
@ 2015-09-22 8:16 ` vries at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2015-09-22 8:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67666
vries at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #5 from vries at gcc dot gnu.org ---
committed patch with test-case, marking resolved-fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/67666] single restrict pointer in struct looses restrict
2015-09-21 10:05 [Bug tree-optimization/67666] New: single restrict pointer in struct looses restrict vries at gcc dot gnu.org
2015-09-21 10:54 ` [Bug tree-optimization/67666] " rguenth at gcc dot gnu.org
2015-09-22 7:02 ` vries at gcc dot gnu.org
@ 2015-09-22 8:16 ` vries at gcc dot gnu.org
2015-09-22 8:16 ` vries at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2015-09-22 8:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67666
--- Comment #4 from vries at gcc dot gnu.org ---
Author: vries
Date: Tue Sep 22 08:15:32 2015
New Revision: 227996
URL: https://gcc.gnu.org/viewcvs?rev=227996&root=gcc&view=rev
Log:
Handle single restrict pointer in struct in create_variable_info_for_1
2015-09-22 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/67666
* tree-ssa-structalias.c (create_variable_info_for_1): Handle struct
with single field non-conservative.
* g++.dg/pr67666.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/pr67666.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-structalias.c
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-09-22 8:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-21 10:05 [Bug tree-optimization/67666] New: single restrict pointer in struct looses restrict vries at gcc dot gnu.org
2015-09-21 10:54 ` [Bug tree-optimization/67666] " rguenth at gcc dot gnu.org
2015-09-22 7:02 ` vries at gcc dot gnu.org
2015-09-22 8:16 ` vries at gcc dot gnu.org
2015-09-22 8:16 ` vries 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).