This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lno] need help with setting may-aliases in the vectorizer


Diego, Richard,

need your help... I'm trying to set the aliases for the new memory
references that I'm creating; I thought I was handling it the way we
discussed in Ottawa, but apparently I'm still getting it wrong.

Say we take the following testcase:

#define N 256
typedef unsigned char auchar __attribute__ ((__aligned__(16)));
void main1 (auchar *sa)
{
  int i;
  for (i = 0; i < N; i++){
      sa[i] = 5;
  }
  bar (sa);
}

What I'm doing is the following:
(it's all in the function tree-vectorizer.c:vect_create_data_ref())

1) creating a new pointer to vector type (vect_ptr)

2) copying the mem_tag of 'sa' to vect_ptr:
            tree symbl = SSA_NAME_VAR (addr_ref);
            tree tag = get_var_ann (symbl)->type_mem_tag;
            get_var_ann (vect_ptr)->type_mem_tag = tag; /* CHECKME */

3) marking all the may-aliases of 'sa' for renaming

4) pointing vect_ptr to the relevant address (which in this case is the
pointer 'sa').

5) creating a data reference using vect_ptr (*vect_p[idx]), and giving it
an ssa_name.

This scheme works ok for the example above - the vdefs/vuses are computed
correctly (line 3 below):

  # BLOCK 0
  # PRED: ENTRY [100.0%]  (fallthru,exec)
1.  vect_p.61<D1638>_21 = (<unnamed type> *)sa<D1553>_3;
2.  vect_cst_.63<D1640>_13 = {5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5};
  # SUCC: 1 [100.0%]  (fallthru,exec)

  # BLOCK 1
  # PRED: 3 [100.0%]  (fallthru) 0 [100.0%]  (fallthru,exec)
  # TMT.43<D1615>_18 = PHI <TMT.43<D1615>_14(0), TMT.43<D1615>_1(3)>;
  # ivtmp.64<D1641>_24 = PHI <0(0), ivtmp.64<D1641>_25(3)>;
  # ivtmp.62<D1639>_22 = PHI <0(0), ivtmp.62<D1639>_23(3)>;
<L0>:;
  #   TMT.43<D1615>_1 = V_MAY_DEF <TMT.43<D1615>_18>;
3.  (*vect_p.61<D1638>_21)[ivtmp.62<D1639>_22] = vect_cst_.63<D1640>_13;
4.  ivtmp.62<D1639>_23 = ivtmp.62<D1639>_22 + 1;
5.  ivtmp.64<D1641>_25 = ivtmp.64<D1641>_24 + 1;
6.  if (ivtmp.64<D1641>_25 < 8) goto <L6>; else goto <L2>;
  # SUCC: 2 [11.0%]  (loop_exit,false,exec) 3 [89.0%]  (dfs_back,true,exec)

But, turns out that it only works because of the call to bar... when I
remove it - the vdefs are not generated (and everything is removed by dce).

This bug can be reproduced with current lno-branch because it now contains
the pointer support (unfortunately all the test cases I used had a call to
bar in them, so I discovered this problem just now).

Marking vect_ptr for renaming did not help; trying to explicitly copy the
may-aliases of the scalar pointer (sa) did not help (i.e:
VARRAY_PUSH_TREE (v_ann->may_aliases, s) for each vdef/vuse of the scalar
pointer); I tried to set a name-tag and may-aliases for the ssa_name I
created for vect_ptr;

help?

dorit


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]