Hi,
this patch adds OPTGROUP_PAR.
It allows a user to see on stderr what loops are parallelized by
pass_parallelize_loops, using -fopt-info-par:
...
$ gcc -O2 -fopt-info-par test.c -ftree-parallelize-loops=32
test.c:5:3: note: parallelized inner loop
...
This patch doesn't include any MSG_MISSED_OPTIMIZATION/MSG_NOTE messages
yet.
Idea of the patch OK?
Any other comments?
Thanks,
- Tom
Add OPTGROUP_PAR
2015-10-19 Tom de Vries <t...@codesourcery.com>
* doc/invoke.texi (@item -fopt-info): Add @item par in group of
optimizations table.
* dumpfile.c (optgroup_options): Add OPTGROUP_PAR entry.
* dumpfile.h (OPTGROUP_PAR): New define.
(OPTGROUP_OTHER): Renumber.
(OPTGROUP_ALL): Add OPTGROUP_PAR.
* tree-parloops.c (parallelize_loops): Handle -fopt-info-par.
(pass_data_parallelize_loops): Change optinfo_flags from OPTGROUP_LOOP
to OPTGROUP_PAR.
---
gcc/doc/invoke.texi | 2 ++
gcc/dumpfile.c | 1 +
gcc/dumpfile.h | 5 +++--
gcc/tree-parloops.c | 16 ++++++++++------
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 54e9f12..629ee37 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7319,6 +7319,8 @@ Enable dumps from all loop optimizations.
Enable dumps from all inlining optimizations.
@item vec
Enable dumps from all vectorization optimizations.
+@item par
+Enable dumps from all auto-parallelization optimizations.
@item optall
Enable dumps from all optimizations. This is a superset of
the optimization groups listed above.
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index e4c4748..421d19b 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -138,6 +138,7 @@ static const struct dump_option_value_info optgroup_options[] =
{"loop", OPTGROUP_LOOP},
{"inline", OPTGROUP_INLINE},
{"vec", OPTGROUP_VEC},
+ {"par", OPTGROUP_PAR},
{"optall", OPTGROUP_ALL},
{NULL, 0}
};
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index 5f30077..52371f4 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -97,9 +97,10 @@ enum tree_dump_index
#define OPTGROUP_LOOP (1 << 2) /* Loop optimization passes */
#define OPTGROUP_INLINE (1 << 3) /* Inlining passes */
#define OPTGROUP_VEC (1 << 4) /* Vectorization passes */
-#define OPTGROUP_OTHER (1 << 5) /* All other passes */
+#define OPTGROUP_PAR (1 << 5) /* Auto-parallelization passes */
+#define OPTGROUP_OTHER (1 << 6) /* All other passes */
#define OPTGROUP_ALL (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \
- | OPTGROUP_VEC | OPTGROUP_OTHER)
+ | OPTGROUP_VEC | OPTGROUP_PAR | OPTGROUP_OTHER)
/* Define a tree dump switch. */
struct dump_file_info
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index c7aa62c..e98c2c7 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -2718,17 +2718,21 @@ parallelize_loops (void)
changed = true;
skip_loop = loop->inner;
+ const char *loop_describe = (loop->inner
+ ? "outer"
+ : "inner");
+ loop_loc = find_loop_location (loop);
if (dump_file && (dump_flags & TDF_DETAILS))
{
- if (loop->inner)
- fprintf (dump_file, "parallelizing outer loop %d\n",loop->header->index);
- else
- fprintf (dump_file, "parallelizing inner loop %d\n",loop->header->index);
- loop_loc = find_loop_location (loop);
+ fprintf (dump_file, "parallelizing %s loop %d\n", loop_describe,
+ loop->header->index);
if (loop_loc != UNKNOWN_LOCATION)
fprintf (dump_file, "\nloop at %s:%d: ",
LOCATION_FILE (loop_loc), LOCATION_LINE (loop_loc));
}
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loop_loc,
+ "parallelized %s loop\n", loop_describe);
gen_parallel_loop (loop, &reduction_list,
n_threads, &niter_desc);
}
@@ -2752,7 +2756,7 @@ const pass_data pass_data_parallelize_loops =
{
GIMPLE_PASS, /* type */
"parloops", /* name */
- OPTGROUP_LOOP, /* optinfo_flags */
+ OPTGROUP_PAR, /* optinfo_flags */
TV_TREE_PARALLELIZE_LOOPS, /* tv_id */
( PROP_cfg | PROP_ssa ), /* properties_required */
0, /* properties_provided */
--
1.9.1