[PATCH 04/10] Use indentation to show nesting for -fopt-info

David Malcolm dmalcolm@redhat.com
Tue May 29 20:32:00 GMT 2018


This converts e.g. from:

test.c:8:3: note: === analyzing loop ===
test.c:8:3: note: === analyze_loop_nest ===
test.c:8:3: note: === vect_analyze_loop_form ===
test.c:8:3: note: === get_loop_niters ===
test.c:8:3: note: symbolic number of iterations is (unsigned int) n_9(D)
test.c:8:3: note: not vectorized: loop contains function calls or data references that cannot be analyzed
test.c:8:3: note: vectorized 0 loops in function

to:

test.c:8:3: note: === analyzing loop ===
test.c:8:3: note:  === analyze_loop_nest ===
test.c:8:3: note:   === vect_analyze_loop_form ===
test.c:8:3: note:    === get_loop_niters ===
test.c:8:3: note:   symbolic number of iterations is (unsigned int) n_9(D)
test.c:8:3: note:   not vectorized: loop contains function calls or data references that cannot be analyzed
test.c:8:3: note: vectorized 0 loops in function

showing the nesting of the optimization analysis and where each
message is being emitted from within it (this is of more use as
the number of messages and the nesting depth increases)

gcc/ChangeLog:
	* optinfo-emit-fopt-info.cc (emit_optinfo_via_fopt_info): Use
	indentation to show nesting.
---
 gcc/optinfo-emit-fopt-info.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/optinfo-emit-fopt-info.cc b/gcc/optinfo-emit-fopt-info.cc
index b01a301..842681f 100644
--- a/gcc/optinfo-emit-fopt-info.cc
+++ b/gcc/optinfo-emit-fopt-info.cc
@@ -58,7 +58,13 @@ emit_optinfo_via_fopt_info (const optinfo *optinfo)
   if (optinfo->details_p ())
     flags |= TDF_DETAILS;
 
+  /* Source location and "note: ".  */
   dump_loc (flags, optinfo->get_location_t ());
+
+  /* Indentation to show scope nesting.  */
+  dump_printf (flags, "%*s", get_optinfo_scope_depth (), "");
+
+  /* The text itself.  */
   for (unsigned i = 0; i < optinfo->num_items (); i++)
     {
       const optinfo_item *item = optinfo->get_item (i);
-- 
1.8.5.3



More information about the Gcc-patches mailing list