]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/116796 - virtual LC SSA broken after unrolling
authorRichard Biener <rguenther@suse.de>
Mon, 23 Sep 2024 09:05:37 +0000 (11:05 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 23 Sep 2024 10:50:59 +0000 (12:50 +0200)
When the unroller unloops loops it tracks whether it changes any
nesting relationship of remaining loops but when scanning a loops
preheader it fails to pass down the LC-SSA-invalidated bitmap, losing
the fact that an unrolled formerly inner loop can now be placed on
an exit of its outer loop.  The following fixes that.

PR tree-optimization/116796
* cfgloopmanip.cc (fix_loop_placements): Get LC-SSA-invalidated
bitmap and pass it on.
(remove_path): Pass LC-SSA-invalidated to fix_loop_placements.

gcc/cfgloopmanip.cc

index 3707db2fdb39cea26ee3ec5372eccc5d28be660c..d37d351fdf3e45e04bea19563a5e04c5b377a045 100644 (file)
@@ -39,7 +39,7 @@ static void loop_redirect_edge (edge, basic_block);
 static void remove_bbs (basic_block *, int);
 static bool rpe_enum_p (const_basic_block, const void *);
 static int find_path (edge, basic_block **);
-static void fix_loop_placements (class loop *, bool *);
+static void fix_loop_placements (class loop *, bool *, bitmap);
 static bool fix_bb_placement (basic_block);
 static void fix_bb_placements (basic_block, bool *, bitmap);
 
@@ -415,7 +415,8 @@ remove_path (edge e, bool *irred_invalidated,
   /* Fix placements of basic blocks inside loops and the placement of
      loops in the loop tree.  */
   fix_bb_placements (from, irred_invalidated, loop_closed_ssa_invalidated);
-  fix_loop_placements (from->loop_father, irred_invalidated);
+  fix_loop_placements (from->loop_father, irred_invalidated,
+                      loop_closed_ssa_invalidated);
 
   if (local_irred_invalidated
       && loops_state_satisfies_p (LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS))
@@ -1048,7 +1049,8 @@ unloop (class loop *loop, bool *irred_invalidated,
    invalidate the information about irreducible regions.  */
 
 static void
-fix_loop_placements (class loop *loop, bool *irred_invalidated)
+fix_loop_placements (class loop *loop, bool *irred_invalidated,
+                    bitmap loop_closed_ssa_invalidated)
 {
   class loop *outer;
 
@@ -1064,7 +1066,7 @@ fix_loop_placements (class loop *loop, bool *irred_invalidated)
         to the loop.  So call fix_bb_placements to fix up the placement
         of the preheader and (possibly) of its predecessors.  */
       fix_bb_placements (loop_preheader_edge (loop)->src,
-                        irred_invalidated, NULL);
+                        irred_invalidated, loop_closed_ssa_invalidated);
       loop = outer;
     }
 }