diff options
author | Richard Guenther <rguenther@suse.de> | 2012-01-04 09:47:12 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-01-04 09:47:12 +0000 |
commit | b4cf8c9da2edb44884f0934bd7624ce21c9bcf04 (patch) | |
tree | bf057bb8c073169669076383bed0f487007bfd0a /gcc | |
parent | 53618d02754d7eaadd0a58fd47e71dc178ea1750 (diff) | |
download | gcc-b4cf8c9da2edb44884f0934bd7624ce21c9bcf04.zip gcc-b4cf8c9da2edb44884f0934bd7624ce21c9bcf04.tar.gz gcc-b4cf8c9da2edb44884f0934bd7624ce21c9bcf04.tar.bz2 |
re PR tree-optimization/49651 (nested lambdas and -O3 produced incorrect integer variable increments)
2012-01-04 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49651
* tree-ssa-structalias.c (type_can_have_subvars): New function.
(var_can_have_subvars): Use it.
(get_constraint_for_1): Only consider subfields if there
can be any.
* gcc.dg/tree-ssa/pta-ptrarith-1.c: Adjust.
* gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise.
From-SVN: r182865
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-structalias.c | 19 |
5 files changed, 29 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4c5fa1..78e69a7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2012-01-04 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/49651 + * tree-ssa-structalias.c (type_can_have_subvars): New function. + (var_can_have_subvars): Use it. + (get_constraint_for_1): Only consider subfields if there + can be any. + 2012-01-03 Jakub Jelinek <jakub@redhat.com> PR bootstrap/51725 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8fa86a8..556e676 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-01-04 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/49651 + * gcc.dg/tree-ssa/pta-ptrarith-1.c: Adjust. + * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. + 2012-01-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51738 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c index 6db9ba0..2a60e1d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */ +/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fdump-tree-ealias" } */ extern void abort (void); struct X { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c index 85b96b1..ddf934b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-ptrarith-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-ccp -fdump-tree-ealias" } */ +/* { dg-options "-O2 -fno-tree-forwprop -fno-tree-ccp -fdump-tree-ealias" } */ extern void abort (void); struct X { diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 56ffca5..5a55d16 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -303,6 +303,7 @@ static varinfo_t first_vi_for_offset (varinfo_t, unsigned HOST_WIDE_INT); static varinfo_t first_or_preceding_vi_for_offset (varinfo_t, unsigned HOST_WIDE_INT); static varinfo_t lookup_vi_for_tree (tree); +static inline bool type_can_have_subvars (const_tree); /* Pool of variable info structures. */ static alloc_pool variable_info_pool; @@ -3275,7 +3276,8 @@ get_constraint_for_1 (tree t, VEC (ce_s, heap) **results, bool address_p, return; cs = *VEC_last (ce_s, *results); - if (cs.type == DEREF) + if (cs.type == DEREF + && type_can_have_subvars (TREE_TYPE (t))) { /* For dereferences this means we have to defer it to solving time. */ @@ -5043,6 +5045,15 @@ sort_fieldstack (VEC(fieldoff_s,heap) *fieldstack) VEC_qsort (fieldoff_s, fieldstack, fieldoff_compare); } +/* Return true if T is a type that can have subvars. */ + +static inline bool +type_can_have_subvars (const_tree t) +{ + /* Aggregates without overlapping fields can have subvars. */ + return TREE_CODE (t) == RECORD_TYPE; +} + /* Return true if V is a tree that we can have subvars for. Normally, this is any aggregate type. Also complex types which are not gimple registers can have subvars. */ @@ -5058,11 +5069,7 @@ var_can_have_subvars (const_tree v) if (!DECL_P (v)) return false; - /* Aggregates without overlapping fields can have subvars. */ - if (TREE_CODE (TREE_TYPE (v)) == RECORD_TYPE) - return true; - - return false; + return type_can_have_subvars (TREE_TYPE (v)); } /* Return true if T is a type that does contain pointers. */ |