This is the mail archive of the gcc-patches@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]

Re: Vectorizer invariant detextion fix


On 5/1/07, Jan Hubicka <jh@suse.cz> wrote:

Hi, for the vectorizer-1.c testcase on i686: extern char lanip[3][40]; typedef struct { char *t[4]; }tx_typ;

int set_names (void)
{
  static tx_typ tt1;
  int ln;
  for (ln = 0; ln < 4; ln++)
      tt1.t[ln] = lanip[1];
}

We now fold (type)lanip[1]; that is an invariant expression lifted out of the
loop into &lanip[1][0] that is gimple_min_invariant and not moved out of the
loop.  This confuse vectorizer and make it to give up on the loop.  I believe
that all we need is to make gimple_min_invariant considered invariant by
vectorizer.

Yes, that's correct.


Bootstrapped/regtested i686-linux, ppc-linux and ia64-linux.
OK?

Ok,


Thanks,
Richard.

        * tree-vectorize.c (vect_is_simple_use): gimple_min_invariant is
        invariant.
Index: tree-vectorizer.c
===================================================================
*** tree-vectorizer.c   (revision 124303)
--- tree-vectorizer.c   (working copy)
*************** vect_is_simple_use (tree operand, loop_v
*** 1644,1649 ****
--- 1644,1655 ----
        *dt = vect_constant_def;
        return true;
      }
+   if (is_gimple_min_invariant (operand))
+    {
+       *def = operand;
+       *dt = vect_invariant_def;
+       return true;
+    }

    if (TREE_CODE (operand) != SSA_NAME)
      {
*************** vect_is_simple_use (tree operand, loop_v
*** 1671,1677 ****
    if (IS_EMPTY_STMT (*def_stmt))
      {
        tree arg = TREE_OPERAND (*def_stmt, 0);
!       if (TREE_CODE (arg) == INTEGER_CST || TREE_CODE (arg) == REAL_CST)
          {
            *def = operand;
            *dt = vect_invariant_def;
--- 1677,1683 ----
    if (IS_EMPTY_STMT (*def_stmt))
      {
        tree arg = TREE_OPERAND (*def_stmt, 0);
!       if (is_gimple_min_invariant (arg))
          {
            *def = operand;
            *dt = vect_invariant_def;



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