[Mlir-commits] [mlir] [mlir][bufferization] handle exit aliases in buffer-loop-hoisting (PR #226951)

Federico Bruzzone llvmlistbot at llvm.org
Sat Oct 3 06:05:04 PDT 2026


================
@@ -567,3 +567,401 @@ func.func @loop_unreachable_parent() {
   }
   return
 }
+
+// -----
+
+// An exit alias, invariant extent and unrelated carried buffer permit hoisting.
+// CHECK-LABEL: func @while_exit_alias(
+// CHECK-SAME: %{{.*}}: index, %[[SIZE:.*]]: index,
+//      CHECK: %[[ALLOC:.*]] = memref.alloc(%[[SIZE]])
+// CHECK-NEXT: %[[LAST:.*]]:2 = scf.while
+// CHECK-NEXT: memref.store {{.*}}, %[[ALLOC]]
+//      CHECK: scf.condition{{.*}} %[[ALLOC]], %{{.*}}
+//      CHECK: ^bb0(%[[CURRENT:.*]]: memref<?xindex>, %[[KEEP:.*]]: memref<1xindex>):
+// CHECK-NEXT: %{{.*}} = memref.load %[[CURRENT]]
+//      CHECK: scf.yield %{{.*}}, %[[KEEP]]
+//      CHECK: %[[VIEW:.*]] = memref.subview %[[LAST]]#0
+//      CHECK: %[[CAST:.*]] = memref.cast %[[VIEW]]
+//      CHECK: memref.load %[[CAST]]
+func.func @while_exit_alias(%n: index, %size: index, %other: memref<1xindex>) -> index {
----------------
FedericoBruzzone wrote:

This test seems to combine lots of things. Can we simplify and split it, if necessary?

https://github.com/llvm/llvm-project/pull/226951


More information about the Mlir-commits mailing list