From: Eric Botcazou Date: Fri, 6 May 2016 15:54:15 +0000 (+0000) Subject: tree-ssa-coalesce.c (gimple_can_coalesce_p): In the optimized case, allow coalescing... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0e19f3b3348baf1a0be7ce81df2613c3a5b3e934;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c65156d0919..0870dfbe7e6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-05-06 Eric Botcazou + + * tree-ssa-coalesce.c (gimple_can_coalesce_p): In the optimized case, + allow coalescing if the types are compatible. + 2016-05-06 David Malcolm * 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 5f8f64514d5..34c3fa16ccf 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; }