]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Implement --param=vect-max-peeling-for-alignment=..
authorXinliang David Li <davidxl@google.com>
Tue, 24 Sep 2013 20:44:03 +0000 (20:44 +0000)
committerXinliang David Li <davidxl@gcc.gnu.org>
Tue, 24 Sep 2013 20:44:03 +0000 (20:44 +0000)
From-SVN: r202875

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/params.def
gcc/tree-vect-data-refs.c

index 47c31a07eb563fdc36951202d22dd42889927f25..49e926257712c3dcb62a14177d5a91ae643aba2c 100644 (file)
@@ -1,3 +1,10 @@
+2013-09-24  Xinliang David Li <davidxl@google.com>
+
+       * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): 
+       Check max peel iterations parameter.
+       * param.def: New parameter.
+       * doc/invoke.texi: Document New parameter.
+
 2013-09-24  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * gimple-pretty-print.c: Various whitespace tweaks.
index aa0f4ed08b797450047ae7634e3d903932ef9139..508bbb43838ae4644c305ceca72cd9bebef32a9f 100644 (file)
@@ -9451,6 +9451,10 @@ The maximum number of run-time checks that can be performed when
 doing loop versioning for alias in the vectorizer.  See option
 @option{-ftree-vect-loop-version} for more information.
 
+@item vect-max-peeling-for-alignment
+The maximum number of loop peels to enhance access alignment
+for vectorizer. Value -1 means 'no limit'.
+
 @item max-iterations-to-track
 The maximum number of iterations of a loop the brute-force algorithm
 for analysis of the number of iterations of the loop tries to evaluate.
index 3c5265160c687d370813247e9fb9f0aa1c098ace..27491378d118d04d338c37f5050e63ce5ce7e34f 100644 (file)
@@ -544,6 +544,11 @@ DEFPARAM(PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS,
          "Bound on number of runtime checks inserted by the vectorizer's loop versioning for alias check",
          10, 0, 0)
 
+DEFPARAM(PARAM_VECT_MAX_PEELING_FOR_ALIGNMENT,
+         "vect-max-peeling-for-alignment",
+         "Max number of loop peels to enhancement alignment of data references in a loop",
+         -1, -1, 64)
+
 DEFPARAM(PARAM_MAX_CSELIB_MEMORY_LOCATIONS,
         "max-cselib-memory-locations",
         "The maximum memory locations recorded by cselib",
index 98055ae01f8ac98a7707b1a70d479dbcfbe97dd2..c8cdcb85df0830c703d14f1a946abf42b0ce2d75 100644 (file)
@@ -1716,6 +1716,30 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
            }
         }
 
+      if (do_peeling)
+        {
+          unsigned max_allowed_peel
+            = PARAM_VALUE (PARAM_VECT_MAX_PEELING_FOR_ALIGNMENT);
+          if (max_allowed_peel != (unsigned)-1)
+            {
+              unsigned max_peel = npeel;
+              if (max_peel == 0)
+                {
+                  gimple dr_stmt = DR_STMT (dr0);
+                  stmt_vec_info vinfo = vinfo_for_stmt (dr_stmt);
+                  tree vtype = STMT_VINFO_VECTYPE (vinfo);
+                  max_peel = TYPE_VECTOR_SUBPARTS (vtype) - 1;
+                }
+              if (max_peel > max_allowed_peel)
+                {
+                  do_peeling = false;
+                  if (dump_enabled_p ())
+                    dump_printf_loc (MSG_NOTE, vect_location,
+                        "Disable peeling, max peels reached: %d\n", max_peel);
+                }
+            }
+        }
+
       if (do_peeling)
         {
          stmt_info_for_cost *si;