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

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


mkazantsev created this revision.
mkazantsev added reviewers: nikic, fhahn, lebedev.ri, reames.
Herald added subscribers: javed.absar, hiraditya.
Herald added a project: All.
mkazantsev requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


https://reviews.llvm.org/D134173

Files:
  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


Index: llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll
===================================================================
--- llvm/test/Transforms/LoopFusion/triple_loop_nest_inner_guard.ll
+++ 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.
Index: llvm/test/Transforms/LoopFusion/loop_nest.ll
===================================================================
--- llvm/test/Transforms/LoopFusion/loop_nest.ll
+++ 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];
Index: llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
===================================================================
--- llvm/test/Transforms/LoopFusion/double_loop_nest_inner_guard.ll
+++ 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.
Index: llvm/lib/Transforms/Scalar/LoopFuse.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopFuse.cpp
+++ llvm/lib/Transforms/Scalar/LoopFuse.cpp
@@ -1696,6 +1696,7 @@
     // 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 @@
     // 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134173.461172.patch
Type: text/x-patch
Size: 2250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220919/ccb9a19c/attachment.bin>


More information about the llvm-commits mailing list