[llvm] [LoopInterchange] Do not interchange guarded imperfect loop nests (PR #201504)
Madhur Amilkanthwar via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 4 08:08:05 PDT 2026
================
@@ -0,0 +1,67 @@
+; RUN: opt < %s -passes=loop-interchange -cache-line-size=64 \
+; RUN: -pass-remarks-missed='loop-interchange' -disable-output \
+; RUN: -pass-remarks-output=%t
+; RUN: FileCheck -input-file=%t %s
+
+; The middle loop header (%for.j) guards the inner loop %for.k: the inner loop
+; only runs when %j != 0, and its exit condition (%k.next == %j) is only
+; well-defined under that guard. Hoisting %for.k out of the guard would make it
+; spin when %j == 0, so the pass must not interchange this nest.
+
+; CHECK: --- !Missed
+; CHECK-NEXT: Pass: loop-interchange
+; CHECK-NEXT: Name: NotTightlyNested
+; CHECK-NEXT: Function: main
+
+ at x = global [3 x [3 x [3 x i32]]] zeroinitializer
+ at w = global [3 x [3 x [3 x i32]]] zeroinitializer
+ at y = global [3 x [3 x [3 x i32]]] zeroinitializer
+
----------------
madhur13490 wrote:
Done
https://github.com/llvm/llvm-project/pull/201504
More information about the llvm-commits
mailing list