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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Aug 21 00:08:30 PDT 2026


================
@@ -345,9 +352,12 @@ struct MemRefDestructurableTypeExternalModel
   getSubelementIndexMap(Type type) const {
     auto memrefType = llvm::cast<MemRefType>(type);
     constexpr int64_t maxMemrefSizeForDestructuring = 16;
-    if (!memrefType.hasStaticShape() ||
-        memrefType.getNumElements() > maxMemrefSizeForDestructuring ||
-        memrefType.getNumElements() == 1)
+    if (!memrefType.hasStaticShape())
----------------
LouisLu060211 wrote:

Added the unit test

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


More information about the Mlir-commits mailing list