diff options
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r-- | gcc/tree-data-ref.c | 70 |
1 files changed, 26 insertions, 44 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index bf30a61..69c5f7b 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -807,7 +807,8 @@ canonicalize_base_object_address (tree addr) return build_fold_addr_expr (TREE_OPERAND (addr, 0)); } -/* Analyze the behavior of memory reference REF. There are two modes: +/* Analyze the behavior of memory reference REF within STMT. + There are two modes: - BB analysis. In this case we simply split the address into base, init and offset components, without reference to any containing loop. @@ -827,9 +828,9 @@ canonicalize_base_object_address (tree addr) Return true if the analysis succeeded and store the results in DRB if so. BB analysis can only fail for bitfield or reversed-storage accesses. */ -bool +opt_result dr_analyze_innermost (innermost_loop_behavior *drb, tree ref, - struct loop *loop) + struct loop *loop, const gimple *stmt) { poly_int64 pbitsize, pbitpos; tree base, poffset; @@ -848,18 +849,12 @@ dr_analyze_innermost (innermost_loop_behavior *drb, tree ref, poly_int64 pbytepos; if (!multiple_p (pbitpos, BITS_PER_UNIT, &pbytepos)) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "failed: bit offset alignment.\n"); - return false; - } + return opt_result::failure_at (stmt, + "failed: bit offset alignment.\n"); if (preversep) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "failed: reverse storage order.\n"); - return false; - } + return opt_result::failure_at (stmt, + "failed: reverse storage order.\n"); /* Calculate the alignment and misalignment for the inner reference. */ unsigned int HOST_WIDE_INT bit_base_misalignment; @@ -895,11 +890,8 @@ dr_analyze_innermost (innermost_loop_behavior *drb, tree ref, if (in_loop) { if (!simple_iv (loop, loop, base, &base_iv, true)) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "failed: evolution of base is not affine.\n"); - return false; - } + return opt_result::failure_at + (stmt, "failed: evolution of base is not affine.\n"); } else { @@ -921,11 +913,8 @@ dr_analyze_innermost (innermost_loop_behavior *drb, tree ref, offset_iv.step = ssize_int (0); } else if (!simple_iv (loop, loop, poffset, &offset_iv, true)) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "failed: evolution of offset is not affine.\n"); - return false; - } + return opt_result::failure_at + (stmt, "failed: evolution of offset is not affine.\n"); } init = ssize_int (pbytepos); @@ -981,7 +970,7 @@ dr_analyze_innermost (innermost_loop_behavior *drb, tree ref, if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "success.\n"); - return true; + return opt_result::success (); } /* Return true if OP is a valid component reference for a DR access @@ -1205,7 +1194,7 @@ create_data_ref (edge nest, loop_p loop, tree memref, gimple *stmt, DR_IS_CONDITIONAL_IN_STMT (dr) = is_conditional_in_stmt; dr_analyze_innermost (&DR_INNERMOST (dr), memref, - nest != NULL ? loop : NULL); + nest != NULL ? loop : NULL, stmt); dr_analyze_indices (dr, nest, loop); dr_analyze_alias (dr); @@ -1318,7 +1307,7 @@ data_ref_compare_tree (tree t1, tree t2) /* Return TRUE it's possible to resolve data dependence DDR by runtime alias check. */ -bool +opt_result runtime_alias_check_p (ddr_p ddr, struct loop *loop, bool speed_p) { if (dump_enabled_p ()) @@ -1327,25 +1316,18 @@ runtime_alias_check_p (ddr_p ddr, struct loop *loop, bool speed_p) DR_REF (DDR_A (ddr)), DR_REF (DDR_B (ddr))); if (!speed_p) - { - if (dump_enabled_p ()) - dump_printf (MSG_MISSED_OPTIMIZATION, - "runtime alias check not supported when optimizing " - "for size.\n"); - return false; - } + return opt_result::failure_at (DR_STMT (DDR_A (ddr)), + "runtime alias check not supported when" + " optimizing for size.\n"); /* FORNOW: We don't support versioning with outer-loop in either vectorization or loop distribution. */ if (loop != NULL && loop->inner != NULL) - { - if (dump_enabled_p ()) - dump_printf (MSG_MISSED_OPTIMIZATION, - "runtime alias check not supported for outer loop.\n"); - return false; - } + return opt_result::failure_at (DR_STMT (DDR_A (ddr)), + "runtime alias check not supported for" + " outer loop.\n"); - return true; + return opt_result::success (); } /* Operator == between two dr_with_seg_len objects. @@ -5043,18 +5025,18 @@ loop_nest_has_data_refs (loop_p loop) reference, returns false, otherwise returns true. NEST is the outermost loop of the loop nest in which the references should be analyzed. */ -bool +opt_result find_data_references_in_stmt (struct loop *nest, gimple *stmt, vec<data_reference_p> *datarefs) { unsigned i; auto_vec<data_ref_loc, 2> references; data_ref_loc *ref; - bool ret = true; data_reference_p dr; if (get_references_in_stmt (stmt, &references)) - return false; + return opt_result::failure_at (stmt, "statement clobbers memory: %G", + stmt); FOR_EACH_VEC_ELT (references, i, ref) { @@ -5065,7 +5047,7 @@ find_data_references_in_stmt (struct loop *nest, gimple *stmt, datarefs->safe_push (dr); } - return ret; + return opt_result::success (); } /* Stores the data references in STMT to DATAREFS. If there is an |