This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 2/5] Use opt-problem.h in try_vectorize_loop_1
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, Richard Sandiford <richard dot sandiford at arm dot com>, David Malcolm <dmalcolm at redhat dot com>
- Date: Mon, 9 Jul 2018 21:11:33 -0400
- Subject: [PATCH 2/5] Use opt-problem.h in try_vectorize_loop_1
- References: <alpine.LSU.2.20.1806251101311.5043@zhemvz.fhfr.qr> <1531185096-17113-1-git-send-email-dmalcolm@redhat.com>
gcc/ChangeLog:
* tree-vectorizer.c: Include "opt-problem.h".
(try_vectorize_loop_1): Convert "loop_vinfo" from loop_vec_info to
opt_loop_vec_info loop_vinfo, and use opt_report to report any
opt_problem thus captured. Use opt_report ro report on successful
loop vectorization.
---
gcc/tree-vectorizer.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 8d54fbb..c60d0d9 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -79,6 +79,7 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "attribs.h"
#include "gimple-pretty-print.h"
+#include "opt-problem.h"
/* Loop or bb location, with hotness information. */
@@ -705,9 +706,17 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
LOCATION_FILE (vect_location.get_location_t ()),
LOCATION_LINE (vect_location.get_location_t ()));
- loop_vec_info loop_vinfo = vect_analyze_loop (loop, orig_loop_vinfo, &shared);
+ opt_loop_vec_info loop_vinfo = vect_analyze_loop (loop, orig_loop_vinfo, &shared);
loop->aux = loop_vinfo;
+ if (!loop_vinfo)
+ if (loop_vinfo.get_problem ())
+ {
+ opt_report report;
+ if (report.remark (vect_location, "couldn't vectorize loop"))
+ loop_vinfo.get_problem ()->report_reason (report);
+ }
+
if (!loop_vinfo || !LOOP_VINFO_VECTORIZABLE_P (loop_vinfo))
{
/* Free existing information if loop is analyzed with some
@@ -775,13 +784,26 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
unsigned HOST_WIDE_INT bytes;
if (current_vector_size.is_constant (&bytes))
- dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
- "loop vectorized vectorized using "
+ {
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+ "loop vectorized vectorized using "
+ HOST_WIDE_INT_PRINT_UNSIGNED " byte "
+ "vectors\n", bytes);
+ opt_report report;
+ // FIXME: is this the correct format code?
+ report.remark (vect_location,
+ "loop vectorized using "
HOST_WIDE_INT_PRINT_UNSIGNED " byte "
- "vectors\n", bytes);
+ "vectors", bytes);
+ }
else
- dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
- "loop vectorized using variable length vectors\n");
+ {
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+ "loop vectorized using variable length vectors\n");
+ opt_report report;
+ report.remark (vect_location,
+ "loop vectorized using variable length vectors");
+ }
loop_p new_loop = vect_transform_loop (loop_vinfo);
(*num_vectorized_loops)++;
--
1.8.5.3