This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lno] Fix names of temporary variables in the vectorizer
- From: Pop Sébastian <pop at gauvain dot u-strasbg dot fr>
- To: DORIT at il dot ibm dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 15 Jan 2004 15:37:12 +0100
- Subject: [lno] Fix names of temporary variables in the vectorizer
Hi,
The vectorizer prints strange names in my dump files: as an
example,
foo (n)
{
<unnamed type> * <E0><9A>)@<C0><F2><FF><BF>.126;
<unnamed type> T<BB>^U@0<F2><FF><BF>r.125;
[...]
I'm not sure why this happens, maybe a bad memory allocation in
vect_get_name_for_new_var? Anyway, the following patch solves the
problem, and prints the following for the same example:
foo (n)
{
<unnamed type> * vect_.126;
<unnamed type> vect_.125;
[...]
However, I'm not sure about the name conventions.
Sebastian
* tree-vectorizer.c (vect_get_name_for_new_var): Removed.
(vect_create_index_for_array_ref, vect_create_data_ref,
vect_create_destination_var): Pass directly "vect_" to
create_tmp_var.
*** tree-vectorizer.c.~1.1.2.10.~ Thu Jan 15 07:49:51 2004
--- tree-vectorizer.c Thu Jan 15 08:08:53 2004
*************** static tree vect_create_destination_var
*** 195,201 ****
static tree vect_create_data_ref (tree, tree, block_stmt_iterator *);
static tree vect_create_index_for_array_ref (tree, block_stmt_iterator *);
static tree get_vectype_for_scalar_type (tree);
- static char *vect_get_name_for_new_var (tree);
/* General untility functions (CHECKME: where do they belong). */
static tree get_array_base (tree);
--- 195,200 ----
*************** destroy_loop_vec_info (loop_vec_info loo
*** 318,362 ****
}
- /* Function vect_get_name_for_new_var.
-
- Return a name for a new variable.
- The current naming scheme appends the prefix "_vect_" to all the
- vectorizer generated variables, and uses the name of a corresponding
- scalar variable VAR if given.
-
- CHECKME: alloca ok?
- CHECKME: naming scheme ok? */
-
- static char *
- vect_get_name_for_new_var (tree var)
- {
- const char *name = NULL;
- const char *prefix = "_vect_";
- const char *prefix_var = "_vect_var";
- int prefix_len;
- char *vec_var_name;
-
- if (var)
- name = get_name (var);
-
- if (name)
- {
- prefix_len = strlen (prefix);
- vec_var_name = alloca (strlen (name) + prefix_len + 1);
- sprintf (vec_var_name, "%s%s", prefix, name);
- }
- else
- {
- prefix_len = strlen (prefix_var);
- vec_var_name = alloca (prefix_len + 1);
- sprintf (vec_var_name, "%s", prefix_var);
- }
-
- return vec_var_name;
- }
-
-
/* POINTER_ARITHMETIC
CHECKME: The RTL expander does not like an ARRAY_REF where the base is a
--- 317,322 ----
*************** static tree
*** 407,413 ****
vect_create_index_for_array_ref (tree stmt, block_stmt_iterator *bsi)
{
tree T0, T1, vec_stmt, mult_expr, new_temp;
- char *new_name;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
struct loop *loop = STMT_VINFO_LOOP (stmt_info);
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
--- 367,372 ----
*************** vect_create_index_for_array_ref (tree st
*** 465,472 ****
int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_info);
tree step_stmt;
! new_name = vect_get_name_for_new_var (scalar_indx);
! new_indx = create_tmp_var (unsigned_intSI_type_node, new_name);
add_referenced_tmp_var (new_indx);
bitmap_set_bit (vars_to_rename, var_ann (new_indx)->uid);
--- 424,430 ----
int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_info);
tree step_stmt;
! new_indx = create_tmp_var (unsigned_intSI_type_node, "vect_");
add_referenced_tmp_var (new_indx);
bitmap_set_bit (vars_to_rename, var_ann (new_indx)->uid);
*************** vect_create_index_for_array_ref (tree st
*** 514,521 ****
/*** create: unsigned int T0; ***/
! new_name = vect_get_name_for_new_var (scalar_indx);
! T0 = create_tmp_var (unsigned_intSI_type_node, new_name);
add_referenced_tmp_var (T0);
--- 472,478 ----
/*** create: unsigned int T0; ***/
! T0 = create_tmp_var (unsigned_intSI_type_node, "vect_");
add_referenced_tmp_var (T0);
*************** vect_create_index_for_array_ref (tree st
*** 530,537 ****
/*** create: unsigned int T1; ***/
! new_name = vect_get_name_for_new_var (scalar_indx);
! T1 = create_tmp_var (unsigned_intSI_type_node, new_name);
add_referenced_tmp_var (T1);
--- 487,493 ----
/*** create: unsigned int T1; ***/
! T1 = create_tmp_var (unsigned_intSI_type_node, "vect_");
add_referenced_tmp_var (T1);
*************** vect_create_data_ref (tree ref, tree stm
*** 666,672 ****
tree ptr_type;
tree array_ptr;
tree array_base;
- char *new_name;
if (dump_file && (dump_flags & TDF_DETAILS))
{
--- 622,627 ----
*************** vect_create_data_ref (tree ref, tree stm
*** 678,686 ****
array_base = get_array_base (ref);
/*** create: vectype *p; ***/
- new_name = vect_get_name_for_new_var (array_base);
ptr_type = build_pointer_type (vectype);
! array_ptr = create_tmp_var (ptr_type, new_name);
add_referenced_tmp_var (array_ptr);
get_var_ann (array_ptr)->mem_tag = array_base;
--- 633,640 ----
array_base = get_array_base (ref);
/*** create: vectype *p; ***/
ptr_type = build_pointer_type (vectype);
! array_ptr = create_tmp_var (ptr_type, "vect_");
add_referenced_tmp_var (array_ptr);
get_var_ann (array_ptr)->mem_tag = array_base;
*************** vect_create_data_ref (tree ref, tree stm
*** 699,706 ****
/*** create: vectype *T0; ***/
! new_name = vect_get_name_for_new_var (array_base);
! T0 = create_tmp_var (ptr_type, new_name);
add_referenced_tmp_var (T0);
get_var_ann (T0)->mem_tag = array_base;
bitmap_set_bit (vars_to_rename, var_ann (array_base)->uid);
--- 653,659 ----
/*** create: vectype *T0; ***/
! T0 = create_tmp_var (ptr_type, "vect_");
add_referenced_tmp_var (T0);
get_var_ann (T0)->mem_tag = array_base;
bitmap_set_bit (vars_to_rename, var_ann (array_base)->uid);
*************** static tree
*** 746,758 ****
vect_create_destination_var (tree scalar_dest, tree vectype)
{
tree vec_dest;
- char *new_name;
if (TREE_CODE (scalar_dest) != SSA_NAME)
abort ();
! new_name = vect_get_name_for_new_var (scalar_dest);
! vec_dest = create_tmp_var (vectype, new_name);
add_referenced_tmp_var (vec_dest);
/* FIXME: introduce new type. */
--- 699,709 ----
vect_create_destination_var (tree scalar_dest, tree vectype)
{
tree vec_dest;
if (TREE_CODE (scalar_dest) != SSA_NAME)
abort ();
! vec_dest = create_tmp_var (vectype, "vect_");
add_referenced_tmp_var (vec_dest);
/* FIXME: introduce new type. */