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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---
            Summary|[4.9 regression] FAIL:      |[4.9 regression] FAIL:
                   |gcc.dg/vect/vect-42.c       |gcc.dg/vect/vect-96.c
                   |scan-tree-dump-times vect   |scan-tree-dump-times vect
                   |"Vectorizing an unaligned   |"Alignment of access forced
                   |access" 4                   |using peeling" 1

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok, hijacking this report for that case.

We get instead of peeling

/space/rguenther/src/svn/trunk/gcc/testsuite/gcc.dg/vect/vect-96.c:22:3: note:
Alignment of access forced using versioning.

We disable peeling because:

  if (do_peeling && !dr0)
    {
      /* Peeling is possible, but there is no data access that is not supported
         unless aligned. So we try to choose the best possible peeling.  */

      /* We should get here only if there are drs with known misalignment.  */
      gcc_assert (!all_misalignments_unknown);

      /* Choose the best peeling from the hash table.  */
      dr0 = vect_peeling_hash_choose_best_peeling (loop_vinfo, &npeel,
                                                   &body_cost_vec);
      if (!dr0 || !npeel)
        do_peeling = false;

npeel == 0 as best peeling for

#(Data Ref: 
#  bb: 4 
#  stmt: _6 = ib[i_17];
#  ref: ib[i_17];
#  base_object: ib;
#  Access function 0: {0, +, 1}_1
#)

where ib is stack-local and thus aligned.

I can see how this makes sense.  Note the testcase contains undefined
behavior (reads from uninitialized memory).

What happens here is that the processing order of DRs in

  FOR_EACH_VEC_ELT (datarefs, i, dr)
    {
...
    }

changed and the resulting dr0 is different.

I'll try to fix the ordering issue but the new result makes sense (and it
won't be changed by the fix).  For

  for (i = 0; i < N; i++)
      pp->ia[i] = ib[i];

it seems misaligning the store is not supported at all on PPC?  The code
doesn't seem to be setup to handle that case properly.  But that's hardly
a regression.

To catch that the code should loop over all DRs, look for
!vect_supportable_dr_alignment () and see whether they all share the
same known misalignment.  If, then peel to align them all at the same
time, if not, then there is no point in peeling (we discover that
later anyway).

Reply via email to