aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2016-05-06 15:54:15 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-05-06 15:54:15 +0000
commit0e19f3b3348baf1a0be7ce81df2613c3a5b3e934 (patch)
treed93512d1d1010352b41cce884495773abf91b190
parentccd88fb795b3f133ca2bc4b9fd41e5143b5a95a8 (diff)
downloadgcc-0e19f3b3348baf1a0be7ce81df2613c3a5b3e934.zip
gcc-0e19f3b3348baf1a0be7ce81df2613c3a5b3e934.tar.gz
gcc-0e19f3b3348baf1a0be7ce81df2613c3a5b3e934.tar.bz2
tree-ssa-coalesce.c (gimple_can_coalesce_p): In the optimized case, allow coalescing if the types are compatible.
* tree-ssa-coalesce.c (gimple_can_coalesce_p): In the optimized case, allow coalescing if the types are compatible. From-SVN: r235980
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-ssa-coalesce.c27
2 files changed, 22 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c65156d..0870dfb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2016-05-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-ssa-coalesce.c (gimple_can_coalesce_p): In the optimized case,
+ allow coalescing if the types are compatible.
+
2016-05-06 David Malcolm <dmalcolm@redhat.com>
* pass_manager.h (pass_manager::register_pass_name): New method.
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index 5f8f645..34c3fa1 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -1569,17 +1569,24 @@ gimple_can_coalesce_p (tree name1, tree name2)
var2 ? LOCAL_DECL_ALIGNMENT (var2) : TYPE_ALIGN (t2)))
return false;
- /* If the types are not the same, check for a canonical type match. This
+ /* If the types are not the same, see whether they are compatible. This
(for example) allows coalescing when the types are fundamentally the
- same, but just have different names.
-
- Note pointer types with different address spaces may have the same
- canonical type. Those are rejected for coalescing by the
- types_compatible_p check. */
- if (TYPE_CANONICAL (t1)
- && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2)
- && types_compatible_p (t1, t2))
- goto check_modes;
+ same, but just have different names.
+
+ In the non-optimized case, we must first test TYPE_CANONICAL because
+ we use it to compute the partition_to_base_index of the map. */
+ if (flag_tree_coalesce_vars)
+ {
+ if (types_compatible_p (t1, t2))
+ goto check_modes;
+ }
+ else
+ {
+ if (TYPE_CANONICAL (t1)
+ && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2)
+ && types_compatible_p (t1, t2))
+ goto check_modes;
+ }
return false;
}