This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] vdefs question (to make vectorizer pass verify ssa)
- From: Dorit Naishlos <DORIT at il dot ibm dot com>
- To: Diego Novillo <dnovillo at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 1 Jan 2004 16:20:07 +0200
- Subject: Re: [tree-ssa] vdefs question (to make vectorizer pass verify ssa)
> As it should. You have seemingly removed all references to variable
> 'a', but have not marked it for renaming. In the current scheme, we do
> not manipulate virtual operands directly. These are added/removed by
> get_stmt_operands when a statement is marked modified.
>
> Question: is your transformation removing *all* references to variable
> 'a'? If so, then all you need to do is mark 'a' for renaming and call
> rewrite_into_ssa, which will DTRT.
>
> If 'a' is still referenced somewhere in the code, then you ought to add
> 'a' to the may-alias set for the memory tag of _vect_a.117 (I assume it
> has one, right?).
I managed to pass verify_ssa doing the following:
- when creating a pointer T0 in the vectorizer:
T0 = create_tmp_var (ptr_type, new_name);
add_referenced_tmp_var (T0);
#if 0
-> if (STMT_VINFO_TYPE (stmt_info) == store_vec_info_type)
-> var_ann (T0)->is_dereferenced_store = 1;
-> else if (STMT_VINFO_TYPE (stmt_info) == load_vec_info_type)
-> var_ann (T0)->is_dereferenced_load = 1;
#endif
* bitmap_set_bit (vars_to_rename, var_ann (array_base)->uid);
- in tree-optimize.c:
if (flag_tree_vectorize)
{
* bitmap_clear (vars_to_rename);
vectorize_loops (fndecl, vars_to_rename, loops, ev_info, TDI_vect);
#if 0
-> compute_may_aliases (fndecl);
#endif
* if (bitmap_first_set_bit (vars_to_rename) >= 0)
* rewrite_into_ssa (fndecl, vars_to_rename, TDI_vect);
}
The lines marked with '*' are the new source lines I added that solved the
problem and allowed the vectorized code to pass the verifiers.
The lines marked with '->' are not required in order to successfully pass
verify_ssa, but update the may-aliases and result in vector loads/stores
that have vdefs/vuses. However, I did not find an API exposed out side of
tree-dfa.c that lets you create new mem-tags and compute may-aliases on
demand; so for now I called compute_may_aliases(), which resulted in over
conservative vdefs/vuses - the pointers I created ended-up aliasing all the
arrays in the function, whereas if I could explicitely set their may-alias
set in the vectorizer I would make each pointer alias only the array it
points to. Is there an API that lets you do that?
thanks,
dorit
----- Forwarded by Dorit Naishlos/Haifa/IBM on 01/01/2004 15:45 -----
Dorit Naishlos
To: Diego Novillo <dnovillo@redhat.com>
31/12/2003 21:08 cc: gcc@gcc.gnu.org
From: Dorit Naishlos/Haifa/IBM@IBMIL
Subject: Re: [tree-ssa] vdefs question (to make vectorizer pass verify ssa)
(Document link: Dorit Naishlos)
> > 4 _vect_a.117_35 = _vect_var.116_34 + _vect_a.114_32;
> >
> I'd prefer if you emitted the PLUS_EXPR with the pointer as the first
> operand. It's an unwritten convention, but I believe a call to fold()
> will switch it around for you.
ok, I'll change that.
> Question: is your transformation removing *all* references to variable
> 'a'?
not necessarily, just those that are vectorized. Within the loop that is
vectorized all the references to 'a' are replaced with references via
pointers.
> If so, then all you need to do is mark 'a' for renaming and call
> rewrite_into_ssa, which will DTRT.
> If 'a' is still referenced somewhere in the code, then you ought to add
> 'a' to the may-alias set for the memory tag of _vect_a.117 (I assume it
> has one, right?).
So how do I add a memory tag to a pointer and a variable to its may-alias
set? basically, what are the things I need to do when I'm creating a new
pointer? is there an example somewhere?
thanks,
dorit
Diego Novillo
<dnovillo@redhat. To: Dorit Naishlos/Haifa/IBM@IBMIL
com> cc: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: [tree-ssa] vdefs question (to make vectorizer pass verify ssa)
31/12/2003 19:31
On Wed, 2003-12-31 at 08:12, Dorit Naishlos wrote:
> The problem I have is with vectorizing a store operation, like the one
> below:
>
> a_2 = PHI <a_21(0), a_25(1)>;
>
> # a_25 = VDEF <a_2>
> a[i] = x;
>
> The vector store that replaces it is of the form
> "*(_vect_a + 16 * i) = vx"
> where _vect_a is a pointer that points to the base of array a (stmt 5
> below):
> 1 _vect_a.114_32 = &a;
> 2 _vect_var.115_33 = (<unnamed type>)i_1;
> 3 _vect_var.116_34 = _vect_var.115_33 * 16;
> 4 _vect_a.117_35 = _vect_var.116_34 + _vect_a.114_32;
>
I'd prefer if you emitted the PLUS_EXPR with the pointer as the first
operand. It's an unwritten convention, but I believe a call to fold()
will switch it around for you.
> 5 *_vect_a.117_35 = _vect_var.109_31;
>
> The scalar store is removed, and the vector store does not have a vdef,
so
> I fail on:
>
As it should. You have seemingly removed all references to variable
'a', but have not marked it for renaming. In the current scheme, we do
not manipulate virtual operands directly. These are added/removed by
get_stmt_operands when a statement is marked modified.
Question: is your transformation removing *all* references to variable
'a'? If so, then all you need to do is mark 'a' for renaming and call
rewrite_into_ssa, which will DTRT.
If 'a' is still referenced somewhere in the code, then you ought to add
'a' to the may-alias set for the memory tag of _vect_a.117 (I assume it
has one, right?).
Diego.