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]

[PATCH] Fix PR65701(?), fix typo in vect_enhance_data_refs_alignment


The following patch fixes a typo (I think) which is present since the
original introduction of the code in vect_enhance_data_refs_alignment.

  if (do_peeling
      && all_misalignments_unknown
      && vect_supportable_dr_alignment (dr0, false))
    {
      /* Check if the target requires to prefer stores over loads, i.e., 
if
         misaligned stores are more expensive than misaligned loads 
(taking
         drs with same alignment into account).  */
      if (first_store && DR_IS_READ (dr0))
        {
...
        }

      /* In case there are only loads with different unknown 
misalignments, use
         peeling only if it may help to align other accesses in the loop.  
*/
      if (!first_store
          && !STMT_VINFO_SAME_ALIGN_REFS (
                  vinfo_for_stmt (DR_STMT (dr0))).length ()
          && vect_supportable_dr_alignment (dr0, false)
              != dr_unaligned_supported)
        do_peeling = false;
    }

the last vect_supportable_dr_alignment check doesn't make much sense.
It's not mentioned in the comment and I see no reason for treating
dr_unaligned_supported any different here compared to
dr_explicit_realign_[optimized].  What would make sense here
would be a test against dr_unaligned_unsupported (thus, typo), but
that is already tested in the condition guarding all the code.

Thus I am testing (and benchmarking) the following patch which
avoids peeling loads for alignment on targets with support for unaligned
loads if that peeling would only align a single data reference.

Bootstrap and regtest in progress on x86_64-unknown-linux-gnu.

Queued for GCC 6 and eventually GCC 5.2 (if it fixes the regression).

Richard.

2015-04-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/65701
	* tree-vect-data-refs.c (vect_enhance_data_refs_alignment):
	Fix typo and then remove redundant test.

Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	(revision 221971)
+++ gcc/tree-vect-data-refs.c	(working copy)
@@ -1618,9 +1608,7 @@ vect_enhance_data_refs_alignment (loop_v
          peeling only if it may help to align other accesses in the loop.  */
       if (!first_store
 	  && !STMT_VINFO_SAME_ALIGN_REFS (
-		  vinfo_for_stmt (DR_STMT (dr0))).length ()
-          && vect_supportable_dr_alignment (dr0, false)
-              != dr_unaligned_supported)
+		  vinfo_for_stmt (DR_STMT (dr0))).length ())
         do_peeling = false;
     }
 


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