http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49628

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm.com

--- Comment #5 from Ira Rosen <irar at il dot ibm.com> 2011-07-05 06:43:18 UTC 
---
(In reply to comment #4)

> I wonder where we are supposed to set GROUP_SIZE here 
In vect_analyze_data_ref_access(),
but your patch does this:

  /* Allow invariant loads in loops.  */
  if (loop_vinfo && dr_step == 0)
    return DR_IS_READ (dr);

preventing detection of interleaving groups for invariant loads. Which is ok,
since you don't support them anyway.

> and how it possibly
> can connect to my change ... ah, the invariant loads from __x_copy.values
> no longer will inhibit vectorization early.  The group is now indeed
> the __x_copy.values[] loads.
> 
> The following fixes it (or rather, avoids looking at this group):

I think this change is correct, there is indeed nothing to enhance.

But this case revealed a problem in STMT_VINFO_STRIDED_ACCESS - it only checks
that the interleaving chain exists, but even if it exists, the access analysis
can later fail, so we should also check the group size:

Index: tree-vectorizer.h
===================================================================
--- tree-vectorizer.h   (revision 175681)
+++ tree-vectorizer.h   (working copy)
@@ -545,7 +547,7 @@ typedef struct _stmt_vec_info {
 #define STMT_VINFO_GROUP_GAP(S)            (S)->gap
 #define STMT_VINFO_GROUP_SAME_DR_STMT(S)   (S)->same_dr_stmt
 #define STMT_VINFO_GROUP_READ_WRITE_DEPENDENCE(S)  (S)->read_write_dep
-#define STMT_VINFO_STRIDED_ACCESS(S)      ((S)->first_element != NULL &&
(S)->data_ref_info)
+#define STMT_VINFO_STRIDED_ACCESS(S)      ((S)->first_element != NULL &&
(S)->data_ref_info && (S)->size > 0)

 #define GROUP_FIRST_ELEMENT(S)          (S)->first_element
 #define GROUP_NEXT_ELEMENT(S)           (S)->next_element

Thanks,
Ira

> 
> Index: gcc/tree-vect-data-refs.c
> ===================================================================
> --- gcc/tree-vect-data-refs.c   (revision 175802)
> +++ gcc/tree-vect-data-refs.c   (working copy)
> @@ -1495,12 +1495,19 @@ vect_enhance_data_refs_alignment (loop_v
>            && GROUP_FIRST_ELEMENT (stmt_info) != stmt)
>          continue;
> 
> +      /* For invariant accesses there is nothing to enhance.  */
> +      if (integer_zerop (DR_STEP (dr)))
> +       continue;
> +
>        supportable_dr_alignment = vect_supportable_dr_alignment (dr, true);
>        do_peeling = vector_alignment_reachable_p (dr);
>        if (do_peeling)

Reply via email to