aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-01-05 11:23:40 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-01-05 11:23:40 +0000
commit5e9fba51b58a9d9dcd28b6ad3992ec4d8640eae2 (patch)
treee872641afdccd098468de2882c535d6f0cd0cd4e /gcc/tree-sra.c
parent75fee9f255425ea84d63dd63dbf6f07af7c036d7 (diff)
downloadgcc-5e9fba51b58a9d9dcd28b6ad3992ec4d8640eae2.zip
gcc-5e9fba51b58a9d9dcd28b6ad3992ec4d8640eae2.tar.gz
gcc-5e9fba51b58a9d9dcd28b6ad3992ec4d8640eae2.tar.bz2
re PR tree-optimization/47005 (ACATS c62002a is miscompiled at -O2)
PR tree-optimization/47005 * tree-sra.c (struct access): Add 'non_addressable' bit. (create_access): Set it for a DECL_NONADDRESSABLE_P field. (decide_one_param_reduction): Return 0 if the parameter is passed by reference and one of the accesses in the group is non_addressable. From-SVN: r168508
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 14fef47..c2ec204 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -173,6 +173,9 @@ struct access
entirely? */
unsigned total_scalarization : 1;
+ /* Is this access an access to a non-addressable field? */
+ unsigned non_addressable : 1;
+
/* Is this access currently in the work queue? */
unsigned grp_queued : 1;
@@ -816,6 +819,10 @@ create_access (tree expr, gimple stmt, bool write)
access->grp_unscalarizable_region = unscalarizable_region;
access->stmt = stmt;
+ if (TREE_CODE (expr) == COMPONENT_REF
+ && DECL_NONADDRESSABLE_P (TREE_OPERAND (expr, 1)))
+ access->non_addressable = 1;
+
return access;
}
@@ -3666,13 +3673,18 @@ decide_one_param_reduction (struct access *repr)
for (; repr; repr = repr->next_grp)
{
gcc_assert (parm == repr->base);
- new_param_count++;
+
+ /* Taking the address of a non-addressable field is verboten. */
+ if (by_ref && repr->non_addressable)
+ return 0;
if (!by_ref || (!repr->grp_maybe_modified
&& !repr->grp_not_necessarilly_dereferenced))
total_size += repr->size;
else
total_size += cur_parm_size;
+
+ new_param_count++;
}
gcc_assert (new_param_count > 0);