https://gcc.gnu.org/g:e97c75d668bacd8a2e901b819e00156f6e9f4c6c

commit r15-3793-ge97c75d668bacd8a2e901b819e00156f6e9f4c6c
Author: Richard Biener <rguent...@suse.de>
Date:   Mon Sep 23 11:05:37 2024 +0200

    tree-optimization/116796 - virtual LC SSA broken after unrolling
    
    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.

Diff:
---
 gcc/cfgloopmanip.cc | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gcc/cfgloopmanip.cc b/gcc/cfgloopmanip.cc
index 3707db2fdb39..d37d351fdf3e 100644
--- a/gcc/cfgloopmanip.cc
+++ b/gcc/cfgloopmanip.cc
@@ -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;
     }
 }

Reply via email to