]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Revert update-ssa assert in vectorizer
authorRichard Biener <rguenther@suse.de>
Mon, 4 Jul 2022 11:53:24 +0000 (13:53 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 4 Jul 2022 11:56:45 +0000 (13:56 +0200)
The following reverts the just added assert that virtual SSA does not
need updating.  It instead goes for a select whitelist of transforms
known to be prone to difficulties with virtual SSA update.

* tree-vect-loop-manip.cc (vect_do_peeling): Revert assert
and update virtual SSA form again.  Assert we do so for
a known set of transforms only.
* tree-vectorizer.h (vec_info::any_known_not_updated_vssa): New.
* tree-vect-stmts.cc (vectorizable_load): When vectorizing
using load-lanes allow virtual SSA update.

gcc/tree-vect-loop-manip.cc
gcc/tree-vect-stmts.cc
gcc/tree-vectorizer.h

index 7b7af944dba001ed71a26ec46865286e074a344a..5c31f0a809174b9c6fa5ea6fe487b47226be0ad9 100644 (file)
@@ -2683,11 +2683,12 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
   class loop *first_loop = loop;
   bool irred_flag = loop_preheader_edge (loop)->flags & EDGE_IRREDUCIBLE_LOOP;
 
-  /* Historically we might have a queued need to update virtual SSA form.
-     As we delete the update SSA machinery below after doing a regular
-     incremental SSA update during loop copying make sure we don't
-     lose that fact.  */
-  gcc_assert (!need_ssa_update_p (cfun));
+  /* We should not have to update virtual SSA form here but some
+     transforms involve creating new virtual definitions which makes
+     updating difficult.  */
+  gcc_assert (!need_ssa_update_p (cfun)
+             || loop_vinfo->any_known_not_updated_vssa);
+  update_ssa (TODO_update_ssa_only_virtuals);
 
   create_lcssa_for_virtual_phi (loop);
 
index d6a6fe3fb384fcaa47abc7f40fff7801b93849db..72107afc883649f96569816d099763a54f959ab0 100644 (file)
@@ -8979,6 +8979,9 @@ vectorizable_load (vec_info *vinfo,
        dump_printf_loc (MSG_NOTE, vect_location,
                         "Vectorizing an unaligned access.\n");
 
+      if (memory_access_type == VMAT_LOAD_STORE_LANES)
+       vinfo->any_known_not_updated_vssa = true;
+
       STMT_VINFO_TYPE (stmt_info) = load_vec_info_type;
       vect_model_load_cost (vinfo, stmt_info, ncopies, vf, memory_access_type,
                            alignment_support_scheme, misalignment,
index 642eb0aeb21264cd736a479b1ec25357abef29cd..e5fdc9e0a14ddf4f8d0574d9a610b5db30e30ffa 100644 (file)
@@ -444,6 +444,10 @@ public:
   /* Whether the above mapping is complete.  */
   bool stmt_vec_info_ro;
 
+  /* Whether we've done a transform we think OK to not update virtual
+     SSA form.  */
+  bool any_known_not_updated_vssa;
+
   /* The SLP graph.  */
   auto_vec<slp_instance> slp_instances;