[Mlir-commits] [mlir] [mlir][memref] Avoid overflow in mem2reg alloca checks (PR #205245)

Hocky Yudhiono llvmlistbot at llvm.org
Thu Aug 20 00:01:02 PDT 2026


================
@@ -343,3 +343,17 @@ func.func @scalable_zero_extent_alloca() {
   %alloca = memref.alloca(%size) : memref<?xf32>
   return
 }
+
+// -----
+
+// Make sure mem2reg does not crash on an alloca whose element count overflows
+// int64. https://github.com/llvm/llvm-project/issues/204297
+
+// CHECK-LABEL: func.func @alloca_element_count_overflow
+func.func @alloca_element_count_overflow() {
+  return
+^bb1(%0: index):
----------------
hockyy wrote:

this is unreachable block, you can simplify this unit test case
```
func.func @simple() {
    %alloca = memref.alloca() : memref<9223372036854775807x3xi32>
    return
  }
```

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


More information about the Mlir-commits mailing list