From bbeeac91f96bdcbc3eb40ec68c1fd8cf5d4a038d Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 13 Nov 2018 16:10:13 +0000 Subject: 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 --- gcc/tree-vectorizer.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'gcc/tree-vectorizer.c') diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 12bf0fc..0a4eca5 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -925,8 +925,9 @@ try_vectorize_loop_1 (hash_table *&simduid_to_vf_htab, } if (!require_loop_vectorize && vect_slp_bb (bb)) { - dump_printf_loc (MSG_NOTE, vect_location, - "basic block vectorized\n"); + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, + "basic block vectorized\n"); fold_loop_internal_call (loop_vectorized_call, boolean_true_node); loop_vectorized_call = NULL; @@ -955,12 +956,15 @@ try_vectorize_loop_1 (hash_table *&simduid_to_vf_htab, set_uid_loop_bbs (loop_vinfo, loop_vectorized_call); unsigned HOST_WIDE_INT bytes; - if (current_vector_size.is_constant (&bytes)) - dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, - "loop vectorized using %wu byte vectors\n", bytes); - else - dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, - "loop vectorized using variable length vectors\n"); + if (dump_enabled_p ()) + { + if (current_vector_size.is_constant (&bytes)) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "loop vectorized using %wu byte vectors\n", bytes); + else + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, + "loop vectorized using variable length vectors\n"); + } loop_p new_loop = vect_transform_loop (loop_vinfo); (*num_vectorized_loops)++; @@ -1289,7 +1293,8 @@ pass_slp_vectorize::execute (function *fun) FOR_EACH_BB_FN (bb, fun) { if (vect_slp_bb (bb)) - dump_printf_loc (MSG_NOTE, vect_location, "basic block vectorized\n"); + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, "basic block vectorized\n"); } if (!in_loop_pipeline) @@ -1447,7 +1452,8 @@ increase_alignment (void) if (alignment && vect_can_force_dr_alignment_p (decl, alignment)) { vnode->increase_alignment (alignment); - dump_printf (MSG_NOTE, "Increasing alignment of decl: %T\n", decl); + if (dump_enabled_p ()) + dump_printf (MSG_NOTE, "Increasing alignment of decl: %T\n", decl); } } -- cgit v1.1