]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/gimple-loop-jam.c
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / gimple-loop-jam.c
index 4842f0dff80e086f928edecf63944e830fc8a5ea..d212e3914894b072d240768f9ec21cf28e4fc3b2 100644 (file)
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-data-ref.h"
 #include "tree-ssa-loop-ivopts.h"
 #include "tree-vectorizer.h"
+#include "tree-ssa-sccvn.h"
 
 /* Unroll and Jam transformation
    
@@ -486,13 +487,12 @@ adjust_unroll_factor (class loop *inner, struct data_dependence_relation *ddr,
 static unsigned int
 tree_loop_unroll_and_jam (void)
 {
-  class loop *loop;
-  bool changed = false;
+  unsigned int todo = 0;
 
   gcc_assert (scev_initialized_p ());
 
   /* Go through all innermost loops.  */
-  FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
+  for (auto loop : loops_list (cfun, LI_ONLY_INNERMOST))
     {
       class loop *outer = loop_outer (loop);
 
@@ -591,7 +591,11 @@ tree_loop_unroll_and_jam (void)
                            &desc);
          free_original_copy_tables ();
          fuse_loops (outer->inner);
-         changed = true;
+         todo |= TODO_cleanup_cfg;
+
+         auto_bitmap exit_bbs;
+         bitmap_set_bit (exit_bbs, single_dom_exit (outer)->dest->index);
+         todo |= do_rpo_vn (cfun, loop_preheader_edge (outer), exit_bbs);
        }
 
       loop_nest.release ();
@@ -599,13 +603,12 @@ tree_loop_unroll_and_jam (void)
       free_data_refs (datarefs);
     }
 
-  if (changed)
+  if (todo)
     {
       scev_reset ();
       free_dominance_info (CDI_DOMINATORS);
-      return TODO_cleanup_cfg;
     }
-  return 0;
+  return todo;
 }
 
 /* Pass boilerplate */