Hi!

As discussed in the PR, we currently don't vectorize
#include <valarray>

std::valarray<int>
f1 (std::valarray<int> a, std::valarray<int> b, std::valarray<int> c, int z)
{
  int i;
  for (i = 0; i < z; i++)
    {
      a[i] = b[i] + c[i];
      a[i] += b[i] * c[i];
    }
  return a;
}

void
f2 (std::valarray<int> &__restrict a, std::valarray<int> &__restrict b, 
std::valarray<int> &__restrict c, int z)
{
  int i;
  for (i = 0; i < z; i++)
    {
      a[i] = b[i] + c[i];
      a[i] += b[i] * c[i];
    }
}

because while the ptr loaded from _M_data is TYPE_RESTRICT, the
reference computed as that pointer plus i * 4 that results from inling
is not TYPE_RESTRICT.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

2011-09-26  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/50522
        * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Don't test
        TYPE_RESTRICT.
        (ptr_derefs_may_alias_p): Call pt_solutions_same_restrict_base
        unconditionally.

--- gcc/tree-ssa-alias.c.jj     2011-09-15 12:18:37.000000000 +0200
+++ gcc/tree-ssa-alias.c        2011-09-26 13:49:24.000000000 +0200
@@ -223,7 +223,6 @@ ptr_deref_may_alias_decl_p (tree ptr, tr
      pointer and that pointers points-to set doesn't contain this decl
      then they can't alias.  */
   if (DECL_RESTRICTED_P (decl)
-      && TYPE_RESTRICT (TREE_TYPE (ptr))
       && pi->pt.vars_contains_restrict)
     return bitmap_bit_p (pi->pt.vars, DECL_PT_UID (decl));
 
@@ -319,9 +318,7 @@ ptr_derefs_may_alias_p (tree ptr1, tree 
 
   /* If both pointers are restrict-qualified try to disambiguate
      with restrict information.  */
-  if (TYPE_RESTRICT (TREE_TYPE (ptr1))
-      && TYPE_RESTRICT (TREE_TYPE (ptr2))
-      && !pt_solutions_same_restrict_base (&pi1->pt, &pi2->pt))
+  if (!pt_solutions_same_restrict_base (&pi1->pt, &pi2->pt))
     return false;
 
   /* ???  This does not use TBAA to prune decls from the intersection

        Jakub

Reply via email to