On Fri, 2018-06-15 at 14:11 -0600, Jeff Law wrote: > On 06/14/2018 02:32 PM, David Malcolm wrote: > > The vectorizer code has numerous instances of: > > > > if (dump_enabled_p ()) > > dump_printf_loc (MSG_NOTE, vect_location, > > "=== some message ===\n"); > > > > In each case, the dump_printf_loc is a MSG_NODE at vect_location. > > > > In almost all cases the message is of the form > > "=== foo ===\n" > > > > The exceptions are: > > "===== analyze_loop_nest =====\n" > > which uses 4 equal signs rather than 3, and > > "===vect_slp_analyze_bb===\n" > > which is missing the spaces. > > > > In most cases (but not always) the message matches the function > > name. > > > > This patch replaces all of these with a macro, taking the message > > as an argument (and forcing the use of three dashes and a space). > > > > The idea is to later convert this macro to use an RAII type > > that pushes and pops scope, so that the nesting structure appears > > in the dumpfile and -fopt-info logs (and in the remarks and > > optimization records introduced later in this patch kit). > > > > The message is usually the function name, but not always. > > Should I split this out into two macros? e.g. a VECT_FUNCTION_SCOPE > > that uses __FUNCTION__? > > > > Would DUMP_VECT_SCOPE be a better name, perhaps? > > > > gcc/ChangeLog: > > * tree-vect-data-refs.c (vect_analyze_data_ref_dependences): > > Replace dump_printf_loc call with VECT_SCOPE. > > (vect_slp_analyze_instance_dependence): Likewise. > > (vect_enhance_data_refs_alignment): Likewise. > > (vect_analyze_data_refs_alignment): Likewise. > > (vect_slp_analyze_and_verify_instance_alignment > > (vect_analyze_data_ref_accesses): Likewise. > > (vect_prune_runtime_alias_test_list): Likewise. > > (vect_analyze_data_refs): Likewise. > > * tree-vect-loop-manip.c (vect_update_inits_of_drs): Likewise. > > * tree-vect-loop.c (vect_determine_vectorization_factor): > > Likewise. > > (vect_analyze_scalar_cycles_1): Likewise. > > (vect_get_loop_niters): Likewise. > > (vect_analyze_loop_form_1): Likewise. > > (vect_update_vf_for_slp): Likewise. > > (vect_analyze_loop_operations): Likewise. > > (vect_analyze_loop): Likewise. > > (vectorizable_induction): Likewise. > > (vect_transform_loop): Likewise. > > * tree-vect-patterns.c (vect_pattern_recog): Likewise. > > * tree-vect-slp.c (vect_analyze_slp): Likewise. > > (vect_make_slp_decision): Likewise. > > (vect_detect_hybrid_slp): Likewise. > > (vect_slp_analyze_operations): Likewise. > > (vect_slp_bb): Likewise. > > * tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): > > Likewise. > > (vectorizable_bswap): Likewise. > > (vectorizable_call): Likewise. > > (vectorizable_simd_clone_call): Likewise. > > (vectorizable_conversion): Likewise. > > (vectorizable_assignment): Likewise. > > (vectorizable_shift): Likewise. > > (vectorizable_operation): Likewise. > > * tree-vectorizer.h (VECT_SCOPE): New macro. > > OK. But rather than using a macro, *consider* just using a normal > function. I'm less and less inclined to use macros as I get older :- > ) > > If there's a solid reason to use a macro, then that's fine.
The reason for doing it as a macro is that I'm planning to turn this into an RAII-style class for pushing and popping scopes, capturing the nesting. That wouldn't work if it was a function. > DUMP_VECT_SCOPE seems better than VEC_SCOPE. Thanks. I've committed the DUMP_VECT_SCOPE version of the patch as r261710 (after usual testing) Dave