diff options
Diffstat (limited to 'gcc/tree-sra.cc')
-rw-r--r-- | gcc/tree-sra.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/tree-sra.cc b/gcc/tree-sra.cc index c26559e..302b73e 100644 --- a/gcc/tree-sra.cc +++ b/gcc/tree-sra.cc @@ -100,6 +100,7 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "tree-sra.h" #include "opts.h" +#include "tree-ssa-alias-compare.h" /* Enumeration of all aggregate reductions we can do. */ enum sra_mode { SRA_MODE_EARLY_IPA, /* early call regularization */ @@ -979,6 +980,7 @@ create_access (tree expr, gimple *stmt, bool write) access->type = TREE_TYPE (expr); access->write = write; access->grp_unscalarizable_region = unscalarizable_region; + access->grp_same_access_path = true; access->stmt = stmt; access->reverse = reverse; @@ -1522,6 +1524,9 @@ build_accesses_from_assign (gimple *stmt) racc = build_access_from_expr_1 (rhs, stmt, false); lacc = build_access_from_expr_1 (lhs, stmt, true); + bool tbaa_hazard + = !types_equal_for_same_type_for_tbaa_p (TREE_TYPE (lhs), TREE_TYPE (rhs)); + if (lacc) { lacc->grp_assignment_write = 1; @@ -1536,6 +1541,8 @@ build_accesses_from_assign (gimple *stmt) bitmap_set_bit (cannot_scalarize_away_bitmap, DECL_UID (lacc->base)); } + if (tbaa_hazard) + lacc->grp_same_access_path = false; } if (racc) @@ -1555,6 +1562,8 @@ build_accesses_from_assign (gimple *stmt) } if (storage_order_barrier_p (lhs)) racc->grp_unscalarizable_region = 1; + if (tbaa_hazard) + racc->grp_same_access_path = false; } if (lacc && racc @@ -2396,7 +2405,7 @@ sort_and_splice_var_accesses (tree var) bool grp_partial_lhs = access->grp_partial_lhs; bool first_scalar = is_gimple_reg_type (access->type); bool unscalarizable_region = access->grp_unscalarizable_region; - bool grp_same_access_path = true; + bool grp_same_access_path = access->grp_same_access_path; bool bf_non_full_precision = (INTEGRAL_TYPE_P (access->type) && TYPE_PRECISION (access->type) != access->size @@ -2432,7 +2441,8 @@ sort_and_splice_var_accesses (tree var) return NULL; } - grp_same_access_path = path_comparable_for_same_access (access->expr); + if (grp_same_access_path) + grp_same_access_path = path_comparable_for_same_access (access->expr); j = i + 1; while (j < access_count) @@ -2496,7 +2506,8 @@ sort_and_splice_var_accesses (tree var) } if (grp_same_access_path - && !same_access_path_p (access->expr, ac2->expr)) + && (!ac2->grp_same_access_path + || !same_access_path_p (access->expr, ac2->expr))) grp_same_access_path = false; ac2->group_representative = access; @@ -3451,7 +3462,7 @@ create_total_scalarization_access (struct access *parent, HOST_WIDE_INT pos, access->grp_write = parent->grp_write; access->grp_total_scalarization = 1; access->grp_hint = 1; - access->grp_same_access_path = path_comparable_for_same_access (expr); + access->grp_same_access_path = 0; access->reverse = reverse_storage_order_for_component_p (expr); access->next_sibling = next_sibling; |