[llvm] 21a9abc - [LoopFuse] Drop loop dispositions before reassigning blocks to other loop

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 03:49:59 PDT 2022


Author: Max Kazantsev
Date: 2022-09-19T17:43:06+07:00
New Revision: 21a9abc1cebfd5022eb4eec754c257342d032d30

URL: https://github.com/llvm/llvm-project/commit/21a9abc1cebfd5022eb4eec754c257342d032d30
DIFF: https://github.com/llvm/llvm-project/commit/21a9abc1cebfd5022eb4eec754c257342d032d30.diff

LOG: [LoopFuse] Drop loop dispositions before reassigning blocks to other loop

This bug was found by recent improvement in SCEV verifier. The code in LoopFuse
directly reassigns blocks to be a part of a different loop, which should automatically
invalidate all related cached loop dispositions.

Differential Revision: https://reviews.llvm.org/D134173
Reviewed By: nikic

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LoopFuse.cpp
    llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
    llvm/test/Transforms/LoopFusion/loop_nest.ll
    llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp
index deaab0b43676e..5157f0571e1d3 100644
--- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp
@@ -1696,6 +1696,7 @@ struct LoopFuser {
     // mergeLatch may remove the only block in FC1.
     SE.forgetLoop(FC1.L);
     SE.forgetLoop(FC0.L);
+    SE.forgetLoopDispositions();
 
     // Move instructions from FC0.Latch to FC1.Latch.
     // Note: mergeLatch requires an updated DT.
@@ -1988,6 +1989,7 @@ struct LoopFuser {
     // mergeLatch may remove the only block in FC1.
     SE.forgetLoop(FC1.L);
     SE.forgetLoop(FC0.L);
+    SE.forgetLoopDispositions();
 
     // Move instructions from FC0.Latch to FC1.Latch.
     // Note: mergeLatch requires an updated DT.

diff  --git a/llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll b/llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
index caa122071b6c3..d94c2229a0fc8 100644
--- a/llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
+++ b/llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
@@ -1,7 +1,4 @@
 ; RUN: opt -S -loop-fusion < %s 2>&1 | FileCheck %s
-; XFAIL: *
-; REQUIRES: asserts
-; Fails due to incorrect cached loop disposition.
 
 ; Verify that LoopFusion can fuse two double-loop nests with guarded inner
 ; loops. Loops are in canonical form.

diff  --git a/llvm/test/Transforms/LoopFusion/loop_nest.ll b/llvm/test/Transforms/LoopFusion/loop_nest.ll
index b9591728dd3dc..44a0ac8093da9 100644
--- a/llvm/test/Transforms/LoopFusion/loop_nest.ll
+++ b/llvm/test/Transforms/LoopFusion/loop_nest.ll
@@ -1,7 +1,4 @@
 ; RUN: opt -S -loop-fusion < %s | FileCheck %s
-; XFAIL: *
-; REQUIRES: asserts
-; Fails due to incorrect cached loop disposition.
 ;
 ;    int A[1024][1024];
 ;    int B[1024][1024];

diff  --git a/llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll b/llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll
index b72b1995f1aa8..065b250c0c14c 100644
--- a/llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll
+++ b/llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll
@@ -1,7 +1,4 @@
 ; RUN: opt -S -loop-fusion < %s 2>&1 | FileCheck %s
-; XFAIL: *
-; REQUIRES: asserts
-; Fails due to incorrect cached loop disposition.
 
 ; Verify that LoopFusion can fuse two triple-loop nests with guarded inner
 ; loops. Loops are in canonical form.


        


More information about the llvm-commits mailing list