diff options
author | Tristan Gingold <gingold@adacore.com> | 2007-10-15 15:57:36 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-10-15 15:57:36 +0200 |
commit | 03bc9897e32e8bc6995129f5347a4606d49ad42c (patch) | |
tree | 7714a8d0d288f8503266b971cfb1f4bed46abd8e /gcc/ada/trans.c | |
parent | 23d083f2866c01cb432d999714fec794e62a3026 (diff) | |
download | gcc-03bc9897e32e8bc6995129f5347a4606d49ad42c.zip gcc-03bc9897e32e8bc6995129f5347a4606d49ad42c.tar.gz gcc-03bc9897e32e8bc6995129f5347a4606d49ad42c.tar.bz2 |
trans.c (gnat_to_gnu): Remove the padding structure more often.
2007-10-15 Tristan Gingold <gingold@adacore.com>
* trans.c (gnat_to_gnu): Remove the padding structure more often.
This optimize assignment to over-aligned record.
From-SVN: r129339
Diffstat (limited to 'gcc/ada/trans.c')
-rw-r--r-- | gcc/ada/trans.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 04729f7..65d45b0 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -4810,15 +4810,16 @@ gnat_to_gnu (Node_Id gnat_node) && !(TREE_CODE (gnu_result_type) == RECORD_TYPE && TYPE_JUSTIFIED_MODULAR_P (gnu_result_type)))) { - /* In this case remove padding only if the inner object is of - self-referential size: in that case it must be an object of - unconstrained type with a default discriminant. In other cases, - we want to avoid copying too much data. */ + /* In this case remove padding only if the inner object type is the + same as gnu_result_type or is of self-referential size (in that later + case it must be an object of unconstrained type with a default + discriminant). We want to avoid copying too much data. */ if (TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE && TYPE_IS_PADDING_P (TREE_TYPE (gnu_result)) - && CONTAINS_PLACEHOLDER_P (TYPE_SIZE - (TREE_TYPE (TYPE_FIELDS - (TREE_TYPE (gnu_result)))))) + && (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))) + == gnu_result_type + || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS + (TREE_TYPE (gnu_result))))))) gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))), gnu_result); } |