[Mlir-commits] [mlir] [MLIR] AllocaOp canonicalization for array allocation in LLVM dialect (PR #221508)
Christian Ulmann
llvmlistbot at llvm.org
Mon Sep 7 01:49:51 PDT 2026
================
@@ -469,6 +469,25 @@ LogicalResult AllocaOp::verify() {
return success();
}
+LogicalResult AllocaOp::canonicalize(AllocaOp op, PatternRewriter &rewriter) {
+ // Convert `alloca Ty, C` to the canonical `alloca [C x Ty], 1` form.
+ APInt numElements;
+ if (!matchPattern(op.getArraySize(), m_ConstantInt(&numElements)) ||
+ numElements.isOne() || numElements.getActiveBits() > 64)
+ return failure();
+
+ Type arrayType =
----------------
Dinistro wrote:
```suggestion
auto arrayType =
```
https://github.com/llvm/llvm-project/pull/221508
More information about the Mlir-commits
mailing list