+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.
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;
}