diff options
author | David Malcolm <dmalcolm@redhat.com> | 2018-11-13 16:10:13 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-11-13 16:10:13 +0000 |
commit | bbeeac91f96bdcbc3eb40ec68c1fd8cf5d4a038d (patch) | |
tree | 14626efce8213f765013cedf40bc8ad860ab9c9b /gcc/tree-vect-loop.c | |
parent | 9228f64cc2ceb54764a302103e3b754c0b6235a2 (diff) | |
download | gcc-bbeeac91f96bdcbc3eb40ec68c1fd8cf5d4a038d.zip gcc-bbeeac91f96bdcbc3eb40ec68c1fd8cf5d4a038d.tar.gz gcc-bbeeac91f96bdcbc3eb40ec68c1fd8cf5d4a038d.tar.bz2 |
Ensure that dump calls are guarded with dump_enabled_p
If called when !dump_enabled_p, the dump_* functions effectively do
nothing, but as of r263178 this doing "nothing" involves non-trivial
work internally.
I wasn't sure whether the dump_* functions should assert that
dump_enabled_p ()
is true when they're called, or if they should bail out immediately
for this case, so in this patch I implemented both, so that we get
an assertion failure, and otherwise bail out for the case where
!dump_enabled_p when assertions are disabled.
The patch also fixes all of the places I found during testing
(on x86_64-pc-linux-gnu) that call into dump_* but which
weren't guarded by
if (dump_enabled_p ())
gcc/ChangeLog:
* dumpfile.c (VERIFY_DUMP_ENABLED_P): New macro.
(dump_gimple_stmt): Use it.
(dump_gimple_stmt_loc): Likewise.
(dump_gimple_expr): Likewise.
(dump_gimple_expr_loc): Likewise.
(dump_generic_expr): Likewise.
(dump_generic_expr_loc): Likewise.
(dump_printf): Likewise.
(dump_printf_loc): Likewise.
(dump_dec): Likewise.
(dump_dec): Likewise.
(dump_hex): Likewise.
(dump_symtab_node): Likewise.
gcc/ChangeLog:
* gimple-loop-interchange.cc (tree_loop_interchange::interchange):
Guard dump call with dump_enabled_p.
* graphite-isl-ast-to-gimple.c (graphite_regenerate_ast_isl): Likewise.
* graphite-optimize-isl.c (optimize_isl): Likewise.
* graphite.c (graphite_transform_loops): Likewise.
* tree-loop-distribution.c (pass_loop_distribution::execute): Likewise.
* tree-parloops.c (parallelize_loops): Likewise.
* tree-ssa-loop-niter.c (number_of_iterations_exit): Likewise.
* tree-vect-data-refs.c (vect_analyze_group_access_1): Likewise.
(vect_prune_runtime_alias_test_list): Likewise.
* tree-vect-loop.c (vect_update_vf_for_slp): Likewise.
(vect_estimate_min_profitable_iters): Likewise.
* tree-vect-slp.c (vect_record_max_nunits): Likewise.
(vect_build_slp_tree_2): Likewise.
(vect_supported_load_permutation_p): Likewise.
(vect_slp_analyze_operations): Likewise.
(vect_slp_analyze_bb_1): Likewise.
(vect_slp_bb): Likewise.
* tree-vect-stmts.c (vect_analyze_stmt): Likewise.
* tree-vectorizer.c (try_vectorize_loop_1): Likewise.
(pass_slp_vectorize::execute): Likewise.
(increase_alignment): Likewise.
From-SVN: r266080
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 1a39b3b..5baf87b 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1399,14 +1399,16 @@ vect_update_vf_for_slp (loop_vec_info loop_vinfo) if (only_slp_in_loop) { - dump_printf_loc (MSG_NOTE, vect_location, - "Loop contains only SLP stmts\n"); + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, + "Loop contains only SLP stmts\n"); vectorization_factor = LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo); } else { - dump_printf_loc (MSG_NOTE, vect_location, - "Loop contains SLP and non-SLP stmts\n"); + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, + "Loop contains SLP and non-SLP stmts\n"); /* Both the vectorization factor and unroll factor have the form current_vector_size * X for some rational X, so they must have a common multiple. */ @@ -3337,7 +3339,8 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, /* Cost model disabled. */ if (unlimited_cost_model (LOOP_VINFO_LOOP (loop_vinfo))) { - dump_printf_loc (MSG_NOTE, vect_location, "cost model disabled.\n"); + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, "cost model disabled.\n"); *ret_min_profitable_niters = 0; *ret_min_profitable_estimate = 0; return; @@ -3350,9 +3353,10 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, unsigned len = LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo).length (); (void) add_stmt_cost (target_cost_data, len, vector_stmt, NULL, 0, vect_prologue); - dump_printf (MSG_NOTE, - "cost model: Adding cost of checks for loop " - "versioning to treat misalignment.\n"); + if (dump_enabled_p ()) + dump_printf (MSG_NOTE, + "cost model: Adding cost of checks for loop " + "versioning to treat misalignment.\n"); } /* Requires loop versioning with alias checks. */ @@ -3379,9 +3383,10 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, (void) add_stmt_cost (target_cost_data, nstmts, scalar_stmt, NULL, 0, vect_prologue); } - dump_printf (MSG_NOTE, - "cost model: Adding cost of checks for loop " - "versioning aliasing.\n"); + if (dump_enabled_p ()) + dump_printf (MSG_NOTE, + "cost model: Adding cost of checks for loop " + "versioning aliasing.\n"); } /* Requires loop versioning with niter checks. */ @@ -3390,9 +3395,10 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, /* FIXME: Make cost depend on complexity of individual check. */ (void) add_stmt_cost (target_cost_data, 1, vector_stmt, NULL, 0, vect_prologue); - dump_printf (MSG_NOTE, - "cost model: Adding cost of checks for loop " - "versioning niters.\n"); + if (dump_enabled_p ()) + dump_printf (MSG_NOTE, + "cost model: Adding cost of checks for loop " + "versioning niters.\n"); } if (LOOP_REQUIRES_VERSIONING (loop_vinfo)) @@ -3440,15 +3446,17 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, else if (npeel < 0) { peel_iters_prologue = assumed_vf / 2; - dump_printf (MSG_NOTE, "cost model: " - "prologue peel iters set to vf/2.\n"); + if (dump_enabled_p ()) + dump_printf (MSG_NOTE, "cost model: " + "prologue peel iters set to vf/2.\n"); /* If peeling for alignment is unknown, loop bound of main loop becomes unknown. */ peel_iters_epilogue = assumed_vf / 2; - dump_printf (MSG_NOTE, "cost model: " - "epilogue peel iters set to vf/2 because " - "peeling for alignment is unknown.\n"); + if (dump_enabled_p ()) + dump_printf (MSG_NOTE, "cost model: " + "epilogue peel iters set to vf/2 because " + "peeling for alignment is unknown.\n"); /* If peeled iterations are unknown, count a taken branch and a not taken branch per peeled loop. Even if scalar loop iterations are known, @@ -3653,9 +3661,10 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, return; } - dump_printf (MSG_NOTE, - " Calculated minimum iters for profitability: %d\n", - min_profitable_iters); + if (dump_enabled_p ()) + dump_printf (MSG_NOTE, + " Calculated minimum iters for profitability: %d\n", + min_profitable_iters); if (!LOOP_VINFO_FULLY_MASKED_P (loop_vinfo) && min_profitable_iters < (assumed_vf + peel_iters_prologue)) |