This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Assorted dump/debug fixes for the vectorizer
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 8 Apr 2013 14:31:23 +0200 (CEST)
- Subject: [PATCH] Assorted dump/debug fixes for the vectorizer
The following avoids the excessive verboseness of get_vectype_*
and leaves better traces of the original stmt in the vectorizer
temporary names by preserving their SSA name version.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2013-04-08 Richard Biener <rguenther@suse.de>
* gimple-pretty-print.c (debug_gimple_stmt): Do not print
extra newline.
* tree-vect-loop.c (vect_determine_vectorization_factor): Dump
determined vector type.
(vect_analyze_data_refs): Likewise.
(vect_get_new_vect_var): Adjust.
(vect_create_destination_var): Preserve SSA name versions.
* tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Do
not dump anything here.
* gfortran.dg/vect/fast-math-mgrid-resid.f: Adjust.
Index: gcc/gimple-pretty-print.c
===================================================================
--- gcc/gimple-pretty-print.c (revision 197486)
+++ gcc/gimple-pretty-print.c (working copy)
@@ -84,7 +84,6 @@ DEBUG_FUNCTION void
debug_gimple_stmt (gimple gs)
{
print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS);
- fprintf (stderr, "\n");
}
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c (revision 197486)
+++ gcc/tree-vect-loop.c (working copy)
@@ -409,6 +409,12 @@ vect_determine_vectorization_factor (loo
}
STMT_VINFO_VECTYPE (stmt_info) = vectype;
+
+ if (dump_enabled_p ())
+ {
+ dump_printf_loc (MSG_NOTE, vect_location, "vectype: ");
+ dump_generic_expr (MSG_NOTE, TDF_SLIM, vectype);
+ }
}
/* The vectorization factor is according to the smallest
Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c (revision 197486)
+++ gcc/tree-vect-data-refs.c (working copy)
@@ -3206,6 +3206,17 @@ vect_analyze_data_refs (loop_vec_info lo
}
return false;
}
+ else
+ {
+ if (dump_enabled_p ())
+ {
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "got vectype for stmt: ");
+ dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_generic_expr (MSG_NOTE, TDF_SLIM,
+ STMT_VINFO_VECTYPE (stmt_info));
+ }
+ }
/* Adjust the minimal vectorization factor according to the
vector type. */
@@ -3293,13 +3304,13 @@ vect_get_new_vect_var (tree type, enum v
switch (var_kind)
{
case vect_simple_var:
- prefix = "vect_";
+ prefix = "vect";
break;
case vect_scalar_var:
- prefix = "stmp_";
+ prefix = "stmp";
break;
case vect_pointer_var:
- prefix = "vect_p";
+ prefix = "vectp";
break;
default:
gcc_unreachable ();
@@ -3307,7 +3318,7 @@ vect_get_new_vect_var (tree type, enum v
if (name)
{
- char* tmp = concat (prefix, name, NULL);
+ char* tmp = concat (prefix, "_", name, NULL);
new_vect_var = create_tmp_reg (type, tmp);
free (tmp);
}
@@ -3836,7 +3847,8 @@ tree
vect_create_destination_var (tree scalar_dest, tree vectype)
{
tree vec_dest;
- const char *new_name;
+ const char *name;
+ char *new_name;
tree type;
enum vect_var_kind kind;
@@ -3845,10 +3857,13 @@ vect_create_destination_var (tree scalar
gcc_assert (TREE_CODE (scalar_dest) == SSA_NAME);
- new_name = get_name (scalar_dest);
- if (!new_name)
- new_name = "var_";
+ name = get_name (scalar_dest);
+ if (name)
+ asprintf (&new_name, "%s_%u", name, SSA_NAME_VERSION (scalar_dest));
+ else
+ asprintf (&new_name, "_%u", SSA_NAME_VERSION (scalar_dest));
vec_dest = vect_get_new_vect_var (type, kind, new_name);
+ free (new_name);
return vec_dest;
}
Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c (revision 197486)
+++ gcc/tree-vect-stmts.c (working copy)
@@ -6094,30 +6094,10 @@ get_vectype_for_scalar_type_and_size (tr
return NULL_TREE;
vectype = build_vector_type (scalar_type, nunits);
- if (dump_enabled_p ())
- {
- dump_printf_loc (MSG_NOTE, vect_location,
- "get vectype with %d units of type ", nunits);
- dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type);
- }
-
- if (!vectype)
- return NULL_TREE;
-
- if (dump_enabled_p ())
- {
- dump_printf_loc (MSG_NOTE, vect_location, "vectype: ");
- dump_generic_expr (MSG_NOTE, TDF_SLIM, vectype);
- }
if (!VECTOR_MODE_P (TYPE_MODE (vectype))
&& !INTEGRAL_MODE_P (TYPE_MODE (vectype)))
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "mode not supported by target.");
- return NULL_TREE;
- }
+ return NULL_TREE;
return vectype;
}
Index: gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f
===================================================================
--- gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f (revision 197574)
+++ gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f (working copy)
@@ -41,6 +41,6 @@ C
! we want to check that predictive commoning did something on the
! vectorized loop, which means we have to have exactly 13 vector
! additions.
-! { dg-final { scan-tree-dump-times "vect_var\[^\\n\]*\\+ " 13 "optimized" } }
+! { dg-final { scan-tree-dump-times "vect_\[^\\n\]*\\+ " 13 "optimized" } }
! { dg-final { cleanup-tree-dump "vect" } }
! { dg-final { cleanup-tree-dump "optimized" } }