X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gcc%2Ftree-sra.c;h=33be0f6aaca6606a340dfc6e93cb90b58b1ec2ad;hb=9600efe1a6c42b8acf7449561760c36968155f83;hp=4529754108c6017e7b383e6c7dfba80048960ac6;hpb=f57017cdbb460190ba75d6c7c1590253a2df849c;p=gcc.git diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 4529754108c..33be0f6aaca 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -79,6 +79,7 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "gimple.h" #include "tree-flow.h" +#include "ipa-prop.h" #include "diagnostic.h" #include "statistics.h" #include "tree-dump.h" @@ -1036,7 +1037,7 @@ build_ref_for_offset_1 (tree *res, tree type, HOST_WIDE_INT offset, HOST_WIDE_INT el_size; if (offset == 0 && exp_type - && useless_type_conversion_p (exp_type, type)) + && types_compatible_p (exp_type, type)) return true; switch (TREE_CODE (type)) @@ -1119,15 +1120,17 @@ build_ref_for_offset_1 (tree *res, tree type, HOST_WIDE_INT offset, minor rewrite of fold_stmt. */ -static bool +bool build_ref_for_offset (tree *expr, tree type, HOST_WIDE_INT offset, tree exp_type, bool allow_ptr) { + location_t loc = expr ? EXPR_LOCATION (*expr) : UNKNOWN_LOCATION; + if (allow_ptr && POINTER_TYPE_P (type)) { type = TREE_TYPE (type); if (expr) - *expr = fold_build1 (INDIRECT_REF, type, *expr); + *expr = fold_build1_loc (loc, INDIRECT_REF, type, *expr); } return build_ref_for_offset_1 (expr, type, offset, exp_type); @@ -1760,7 +1763,6 @@ generate_subtree_copies (struct access *access, tree agg, insert_after ? GSI_NEW_STMT : GSI_SAME_STMT); stmt = gimple_build_assign (expr, repl); - sra_stats.subtree_copies++; } if (insert_after) @@ -1768,6 +1770,7 @@ generate_subtree_copies (struct access *access, tree agg, else gsi_insert_before (gsi, stmt, GSI_SAME_STMT); update_stmt (stmt); + sra_stats.subtree_copies++; } if (access->first_child) @@ -1968,6 +1971,7 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc, enum unscalarized_data_handling *refreshed, tree lhs) { + location_t loc = EXPR_LOCATION (lacc->expr); do { if (lacc->grp_to_be_replaced) @@ -1982,7 +1986,7 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc, { rhs = get_access_replacement (racc); if (!useless_type_conversion_p (lacc->type, racc->type)) - rhs = fold_build1 (VIEW_CONVERT_EXPR, lacc->type, rhs); + rhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR, lacc->type, rhs); } else { @@ -2080,6 +2084,7 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi, tree lhs, rhs; bool modify_this_stmt = false; bool force_gimple_rhs = false; + location_t loc = gimple_location (*stmt); if (!gimple_assign_single_p (*stmt)) return SRA_SA_NONE; @@ -2152,7 +2157,7 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi, } if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs))) { - rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs); + rhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR, TREE_TYPE (lhs), rhs); if (!is_gimple_reg (lhs)) force_gimple_rhs = true; }