diff options
author | Richard Guenther <rguenther@suse.de> | 2009-05-03 19:55:55 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-05-03 19:55:55 +0000 |
commit | 16c337707b0c71829fcad74fdc82d85b1f103eaf (patch) | |
tree | c994ca1477a25fea22b8bbec8ca9896c6a292728 /gcc/tree-ssa.c | |
parent | 62a67c94b776e5d07acd247e8a68f60f2a824024 (diff) | |
download | gcc-16c337707b0c71829fcad74fdc82d85b1f103eaf.zip gcc-16c337707b0c71829fcad74fdc82d85b1f103eaf.tar.gz gcc-16c337707b0c71829fcad74fdc82d85b1f103eaf.tar.bz2 |
re PR tree-optimization/23329 (hack in may_propagate_copy should be able to removed)
2009-05-03 Richard Guenther <rguenther@suse.de>
PR middle-end/23329
* tree-ssa.c (useless_type_conversion_p_1): Use get_deref_alias_set.
Do not lose casts from array types with unknown extent to array
types with known extent.
* tree-ssa-copy.c (may_propagate_copy): Remove hack checking for
alias set compatibility.
From-SVN: r147082
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index edbae39..10ec35b 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -961,12 +961,9 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) && TYPE_VOLATILE (TREE_TYPE (outer_type))) return false; - /* Do not lose casts between pointers with different - TYPE_REF_CAN_ALIAS_ALL setting or alias sets. */ - if ((TYPE_REF_CAN_ALIAS_ALL (inner_type) - != TYPE_REF_CAN_ALIAS_ALL (outer_type)) - || (get_alias_set (TREE_TYPE (inner_type)) - != get_alias_set (TREE_TYPE (outer_type)))) + /* Do not lose casts between pointers that when dereferenced access + memory with different alias sets. */ + if (get_deref_alias_set (inner_type) != get_deref_alias_set (outer_type)) return false; /* We do not care for const qualification of the pointed-to types @@ -1002,6 +999,13 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) if (TREE_CODE (inner_type) != TREE_CODE (outer_type)) return false; + /* Conversions from array types with unknown extent to + array types with known extent are not useless. */ + if (TREE_CODE (inner_type) == ARRAY_TYPE + && !TYPE_DOMAIN (inner_type) + && TYPE_DOMAIN (outer_type)) + return false; + /* ??? This seems to be necessary even for aggregates that don't have TYPE_STRUCTURAL_EQUALITY_P set. */ |