tree-vect-loop.c (vect_analyze_loop_operations): Not relevant PHIs are ok.
authorRichard Biener <rguenther@suse.de>
Fri, 2 Jun 2017 10:26:10 +0000 (10:26 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 2 Jun 2017 10:26:10 +0000 (10:26 +0000)
2017-06-02  Richard Biener  <rguenther@suse.de>

* tree-vect-loop.c (vect_analyze_loop_operations): Not relevant
PHIs are ok.
* tree-vect-stmts.c (process_use): Do not mark backedge defs
for inductions as relevant.

From-SVN: r248820

gcc/ChangeLog
gcc/tree-vect-loop.c
gcc/tree-vect-stmts.c

index db9e2430d05ded887134912e0fb453adb4af136b..122c8cdcf7259708c874ec5bf8902f7d181926fc 100644 (file)
@@ -1,3 +1,10 @@
+2017-06-02  Richard Biener  <rguenther@suse.de>
+
+       * tree-vect-loop.c (vect_analyze_loop_operations): Not relevant
+       PHIs are ok.
+       * tree-vect-stmts.c (process_use): Do not mark backedge defs
+       for inductions as relevant.
+
 2017-06-02  Richard Biener  <rguenther@suse.de>
 
        * tree-vect-loop.c (get_initial_def_for_induction): Inline into ...
index 27fe80852e29b28b27f75aaa4159cf694b975334..107f082366a16766eaae67cb46cc36b194fad464 100644 (file)
@@ -1708,8 +1708,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
                  are not used in the outerloop (unless it is double reduction,
                  i.e., this phi is vect_reduction_def), cause this case
                  requires to actually do something here.  */
-              if ((!STMT_VINFO_RELEVANT_P (stmt_info)
-                   || STMT_VINFO_LIVE_P (stmt_info))
+              if (STMT_VINFO_LIVE_P (stmt_info)
                   && STMT_VINFO_DEF_TYPE (stmt_info)
                      != vect_double_reduction_def)
                 {
index 7490b08b454697bc87d10b9443ff2c96ccdb6714..1e9d42cd53f530f5ec3a48da1754a4a975e25425 100644 (file)
@@ -579,6 +579,20 @@ process_use (gimple *stmt, tree use, loop_vec_info loop_vinfo,
           gcc_unreachable ();
         }
     }
+  /* We are also not interested in uses on loop PHI backedges that are
+     inductions.  Otherwise we'll needlessly vectorize the IV increment
+     and cause hybrid SLP for SLP inductions.  */
+  else if (gimple_code (stmt) == GIMPLE_PHI
+          && STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_induction_def
+          && (PHI_ARG_DEF_FROM_EDGE (stmt, loop_latch_edge (bb->loop_father))
+              == use))
+    {
+      if (dump_enabled_p ())
+       dump_printf_loc (MSG_NOTE, vect_location,
+                         "induction value on backedge.\n");
+      return true;
+    }
+
 
   vect_mark_relevant (worklist, def_stmt, relevant, false);
   return true;