From 1314f5b4309d5e889b26076be2fe036dc84aecea Mon Sep 17 00:00:00 2001 From: Schrodinger ZHU Yifan Date: Wed, 6 Nov 2024 23:59:52 -0500 Subject: [PATCH] [gccjit] fix faulty allocation code --- src/Conversion/ConvertMemrefToGCCJIT.cpp | 151 +++++++---------------- src/Translation/TranslateToGCCJIT.cpp | 66 +++++++++- test/lowering/alloc.mlir | 17 +-- test/lowering/alloca.mlir | 37 +----- 4 files changed, 116 insertions(+), 155 deletions(-) diff --git a/src/Conversion/ConvertMemrefToGCCJIT.cpp b/src/Conversion/ConvertMemrefToGCCJIT.cpp index c8e128a..b99b2d7 100644 --- a/src/Conversion/ConvertMemrefToGCCJIT.cpp +++ b/src/Conversion/ConvertMemrefToGCCJIT.cpp @@ -121,19 +121,13 @@ class AllocationLowering : public GCCJITLoweringPattern { int64_t alignedAllocationGetAlignment(ConversionPatternRewriter &rewriter, Location loc, OpType op) const; - std::tuple - allocateBufferManuallyAlign(ConversionPatternRewriter &rewriter, Location loc, - Value sizeBytes, OpType op, - Value alignment) const; - /// Allocates a memory buffer using an aligned allocation method. Value allocateBufferAutoAlign(ConversionPatternRewriter &rewriter, Location loc, Value sizeBytes, OpType op, - int64_t alignment) const; + Value alignment) const; - virtual std::tuple - allocateBuffer(ConversionPatternRewriter &rewriter, Location loc, Value size, - OpType op) const = 0; + virtual void allocateBuffer(ConversionPatternRewriter &rewriter, Location loc, + Value size, OpType op) const = 0; private: static constexpr uint64_t kMinAlignedAllocAlignment = 16UL; @@ -366,7 +360,7 @@ Value AllocationLowering::getAlignment( Type indexType = this->getIndexType(); alignment = this->createIndexAttrConstant(rewriter, loc, indexType, *alignmentAttr); - } else if (!memRefType.getElementType().isSignlessIntOrIndexOrFloat()) { + } else { alignment = this->getAlignInBytes(loc, memRefType.getElementType(), rewriter); } @@ -390,63 +384,21 @@ Value AllocationLowering::createAligned( } template -std::tuple -AllocationLowering::allocateBufferManuallyAlign( +Value AllocationLowering::allocateBufferAutoAlign( ConversionPatternRewriter &rewriter, Location loc, Value sizeBytes, - OpType op, Value alignment) const { - if (alignment) { - // Adjust the allocation size to consider alignment. - sizeBytes = rewriter.create( - loc, sizeBytes.getType(), BOp::Plus, sizeBytes, alignment); - } - + OpType op, Value allocAlignment) const { MemRefType memRefType = getMemRefResultType(op); - // Allocate the underlying buffer. + sizeBytes = createAligned(rewriter, loc, sizeBytes, allocAlignment); Type elementPtrType = this->getElementPtrType(memRefType); - Value allocatedPtr = + auto result = rewriter .create( loc, this->getVoidPtrType(), - SymbolRefAttr::get(this->getContext(), "malloc"), - ValueRange{sizeBytes}, + SymbolRefAttr::get(this->getContext(), "aligned_alloc"), + ValueRange{allocAlignment, sizeBytes}, /* tailcall */ nullptr, /* builtin */ rewriter.getUnitAttr()) .getResult(); - if (!allocatedPtr) - return std::make_tuple(Value(), Value()); - Value alignedPtr = allocatedPtr; - if (alignment) { - // Compute the aligned pointer. - Value allocatedInt = rewriter.create( - loc, this->getIndexType(), allocatedPtr); - Value alignmentInt = createAligned(rewriter, loc, allocatedInt, alignment); - alignedPtr = - rewriter.create(loc, elementPtrType, alignmentInt); - } else { - alignedPtr = - rewriter.create(loc, elementPtrType, allocatedPtr); - } - - return std::make_tuple(allocatedPtr, alignedPtr); -} - -template -Value AllocationLowering::allocateBufferAutoAlign( - ConversionPatternRewriter &rewriter, Location loc, Value sizeBytes, - OpType op, int64_t alignment) const { - Value allocAlignment = - createIndexAttrConstant(rewriter, loc, this->getIndexType(), alignment); - - MemRefType memRefType = getMemRefResultType(op); - sizeBytes = createAligned(rewriter, loc, sizeBytes, allocAlignment); - - Type elementPtrType = this->getElementPtrType(memRefType); - auto result = rewriter.create( - loc, this->getVoidPtrType(), - SymbolRefAttr::get(this->getContext(), "aligned_alloc"), - ValueRange{allocAlignment, sizeBytes}, - /* tailcall */ nullptr, /* builtin */ rewriter.getUnitAttr()); - return rewriter.create(loc, elementPtrType, result); } @@ -523,58 +475,48 @@ LogicalResult AllocationLowering::matchAndRewrite( return rewriter.notifyMatchFailure(op, "incompatible memref type"); auto loc = op->getLoc(); auto convertedType = this->getTypeConverter()->convertType(memRefType); - auto exprBundle = rewriter.replaceOpWithNewOp(op, convertedType); - auto *block = rewriter.createBlock(&exprBundle.getBody()); + + // Get actual sizes of the memref as values: static sizes are constant + // values and dynamic sizes are passed to 'alloc' as operands. In case of + // zero-dimensional memref, assume a scalar (size 1). + SmallVector sizes; + SmallVector strides; + Value size; + + this->getMemRefDescriptorSizes(loc, memRefType, adaptor.getOperands(), + rewriter, sizes, strides, size, true); + auto elementPtrType = this->getElementPtrType(memRefType); + auto exprBundle = rewriter.create(op.getLoc(), elementPtrType); { - OpBuilder::InsertionGuard guard(rewriter); + auto *block = rewriter.createBlock(&exprBundle.getBody()); rewriter.setInsertionPointToStart(block); - // Get actual sizes of the memref as values: static sizes are constant - // values and dynamic sizes are passed to 'alloc' as operands. In case of - // zero-dimensional memref, assume a scalar (size 1). - SmallVector sizes; - SmallVector strides; - Value size; - - this->getMemRefDescriptorSizes(loc, memRefType, adaptor.getOperands(), - rewriter, sizes, strides, size, true); - // Allocate the underlying buffer. - auto [allocatedPtr, alignedPtr] = - this->allocateBuffer(rewriter, loc, size, op); - - if (!allocatedPtr || !alignedPtr) - return rewriter.notifyMatchFailure(loc, - "underlying buffer allocation failed"); - - auto arrayTy = ArrayType::get(rewriter.getContext(), this->getIndexType(), - memRefType.getRank()); - auto sizeArr = rewriter.create(loc, arrayTy, sizes); - auto strideArr = rewriter.create(loc, arrayTy, strides); - auto zero = - this->createIndexAttrConstant(rewriter, loc, this->getIndexType(), 0); - // Create the MemRef descriptor. - auto memRefDescriptor = rewriter.create( - loc, convertedType, ArrayRef{0, 1, 2, 3, 4}, - ValueRange{alignedPtr, allocatedPtr, zero, sizeArr, strideArr}); - - // Return the final value of the descriptor. - rewriter.create(loc, memRefDescriptor); + this->allocateBuffer(rewriter, loc, size, op); } + rewriter.setInsertionPoint(op); + + auto arrayTy = ArrayType::get(rewriter.getContext(), this->getIndexType(), + memRefType.getRank()); + auto sizeArr = rewriter.create(loc, arrayTy, sizes); + auto strideArr = rewriter.create(loc, arrayTy, strides); + auto zero = + this->createIndexAttrConstant(rewriter, loc, this->getIndexType(), 0); + // Create the MemRef descriptor. + rewriter.replaceOpWithNewOp( + op, convertedType, ArrayRef{0, 1, 2, 3, 4}, + ValueRange{exprBundle, exprBundle, zero, sizeArr, strideArr}); + return success(); } struct AllocaOpLowering : public AllocationLowering { using AllocationLowering::AllocationLowering; - std::tuple - allocateBuffer(ConversionPatternRewriter &rewriter, Location loc, Value size, - memref::AllocaOp op) const override final { + void allocateBuffer(ConversionPatternRewriter &rewriter, Location loc, + Value size, memref::AllocaOp op) const override final { auto allocaOp = cast(op); auto elementType = typeConverter->convertType(allocaOp.getType().getElementType()); - if (allocaOp.getType().getMemorySpace()) - return std::make_tuple(Value(), Value()); - auto elementPtrType = PointerType::get(rewriter.getContext(), elementType); Value alloca; @@ -600,19 +542,18 @@ struct AllocaOpLowering : public AllocationLowering { /* builtin */ rewriter.getUnitAttr()) .getResult(); } - alloca = rewriter.create(loc, elementPtrType, alloca); - - return std::make_tuple(alloca, alloca); + rewriter.create(loc, alloca); } }; struct AllocOpLowering : public AllocationLowering { - std::tuple - allocateBuffer(ConversionPatternRewriter &rewriter, Location loc, - Value sizeBytes, memref::AllocOp op) const override final { - return allocateBufferManuallyAlign(rewriter, loc, sizeBytes, op, - getAlignment(rewriter, loc, op)); + void allocateBuffer(ConversionPatternRewriter &rewriter, Location loc, + Value sizeBytes, + memref::AllocOp op) const override final { + auto result = allocateBufferAutoAlign(rewriter, loc, sizeBytes, op, + getAlignment(rewriter, loc, op)); + rewriter.create(loc, result); } using AllocationLowering::AllocationLowering; }; diff --git a/src/Translation/TranslateToGCCJIT.cpp b/src/Translation/TranslateToGCCJIT.cpp index dc54ed6..582958b 100644 --- a/src/Translation/TranslateToGCCJIT.cpp +++ b/src/Translation/TranslateToGCCJIT.cpp @@ -15,6 +15,7 @@ #include "mlir-gccjit/Translation/TranslateToGCCJIT.h" #include +#include #include #include @@ -106,6 +107,8 @@ class RegionVisitor { gcc_jit_rvalue *visitExprWithoutCache(PtrCallOp op); gcc_jit_rvalue *visitExprWithoutCache(AddrOp op); gcc_jit_rvalue *visitExprWithoutCache(FnAddrOp op); + gcc_jit_rvalue *visitExprWithoutCache(NewStructOp op); + gcc_jit_rvalue *visitExprWithoutCache(NewArrayOp op); gcc_jit_lvalue *visitExprWithoutCache(GetGlobalOp op); Expr visitExprWithoutCache(ExprOp op); gcc_jit_lvalue *visitExprWithoutCache(DerefOp op); @@ -571,6 +574,8 @@ Expr RegionVisitor::visitExpr(Value value, bool toplevel) { .Case([&](ExprOp op) { return visitExprWithoutCache(op); }) .Case([&](DerefOp op) { return visitExprWithoutCache(op); }) .Case([&](AccessFieldOp op) { return visitExprWithoutCache(op); }) + .Case([&](NewStructOp op) { return visitExprWithoutCache(op); }) + .Case([&](NewArrayOp op) { return visitExprWithoutCache(op); }) .Default([](Operation *op) -> Expr { llvm::report_fatal_error("unknown expression type"); }); @@ -606,6 +611,32 @@ Expr RegionVisitor::visitExprWithoutCache(AccessFieldOp op) { return gcc_jit_rvalue_access_field(composite, loc, field); } +gcc_jit_rvalue *RegionVisitor::visitExprWithoutCache(NewStructOp op) { + auto *rawStructTy = getTranslator().convertType(op.getType()); + auto *structTy = gcc_jit_type_is_struct(rawStructTy); + if (!structTy) + llvm_unreachable("expected struct type"); + llvm::SmallVector fields; + llvm::SmallVector values; + for (auto field : op.getIndices()) + fields.push_back( + gcc_jit_struct_get_field(structTy, static_cast(field))); + visitExprAsRValue(op.getElements(), values); + auto *loc = getTranslator().getLocation(op.getLoc()); + return gcc_jit_context_new_struct_constructor(getContext(), loc, rawStructTy, + values.size(), fields.data(), + values.data()); +} + +gcc_jit_rvalue *RegionVisitor::visitExprWithoutCache(NewArrayOp op) { + auto *arrayTy = getTranslator().convertType(op.getType()); + auto *loc = getTranslator().getLocation(op.getLoc()); + llvm::SmallVector values; + visitExprAsRValue(op.getElements(), values); + return gcc_jit_context_new_array_constructor(getContext(), loc, arrayTy, + values.size(), values.data()); +} + Expr RegionVisitor::visitExprWithoutCache(ExprOp op) { RegionVisitor visitor(getTranslator(), op.getRegion(), this); return visitor.translateIntoContext(); @@ -663,11 +694,42 @@ gcc_jit_rvalue *RegionVisitor::visitExprWithoutCache(LiteralOp op) { gcc_jit_rvalue *RegionVisitor::visitExprWithoutCache(SizeOfOp op) { auto type = op.getType(); auto *typeHandle = getTranslator().convertType(type); - return gcc_jit_context_new_sizeof(getContext(), typeHandle); + auto *size = gcc_jit_context_new_sizeof(getContext(), typeHandle); + auto *loc = getTranslator().getLocation(op.getLoc()); + auto resTy = op.getResult().getType(); + auto *resTyHandle = getTranslator().convertType(resTy); + if (resTy.getKind() != GCC_JIT_TYPE_INT) + size = gcc_jit_context_new_cast(getContext(), loc, size, resTyHandle); + return size; } gcc_jit_rvalue *RegionVisitor::visitExprWithoutCache(AlignOfOp op) { - llvm_unreachable("GCCJIT does not support alignof yet"); +#ifdef LIBGCCJIT_ABI_28 + auto type = op.getType(); + auto *typeHandle = getTranslator().convertType(type); + auto *align = gcc_jit_context_new_alignof(getContext(), typeHandle); + auto *loc = getTranslator().getLocation(op.getLoc()); + auto resTy = op.getResult().getType(); + auto *resTyHandle = getTranslator().convertType(resTy); + if (resTy.getKind() != GCC_JIT_TYPE_INT) + align = gcc_jit_context_new_cast(getContext(), loc, align, resTyHandle); + return align; +#endif + auto type = op.getType(); + auto *typeHandle = getTranslator().convertType(type); + auto *resTyHandle = getTranslator().convertType(op.getResult().getType()); + auto *typePtrHandle = gcc_jit_type_get_pointer(typeHandle); + auto *nullPtr = gcc_jit_context_null(getContext(), typePtrHandle); + auto *indexTy = gcc_jit_context_get_type(getContext(), GCC_JIT_TYPE_SIZE_T); + auto *one = gcc_jit_context_one(getContext(), indexTy); + auto *loc = getTranslator().getLocation(op.getLoc()); + auto *access = + gcc_jit_context_new_array_access(getContext(), loc, nullPtr, one); + auto *addr = gcc_jit_lvalue_get_address(access, loc); + auto *addrInt = gcc_jit_context_new_bitcast(getContext(), loc, addr, indexTy); + auto *align = + gcc_jit_context_new_cast(getContext(), loc, addrInt, resTyHandle); + return align; } gcc_jit_rvalue *RegionVisitor::visitExprWithoutCache(AsRValueOp op) { diff --git a/test/lowering/alloc.mlir b/test/lowering/alloc.mlir index 6c3ed4c..edf1e2d 100644 --- a/test/lowering/alloc.mlir +++ b/test/lowering/alloc.mlir @@ -4,30 +4,19 @@ module @test { func.func @foo() { - // CHECK: gccjit.call builtin @malloc(%{{[0-9]+}}) : (!gccjit.int) -> !gccjit.ptr + // CHECK: gccjit.call builtin @aligned_alloc(%{{[0-9]+}}, %{{[0-9]+}}) : (!gccjit.int, !gccjit.int) -> !gccjit.ptr %a = memref.alloc () : memref<100x100xf32> return } func.func @bar(%arg0 : index, %arg1: index) { - // CHECK: gccjit.call builtin @malloc(%{{[0-9]+}}) : (!gccjit.int) -> !gccjit.ptr + // CHECK: gccjit.call builtin @aligned_alloc(%{{[0-9]+}}, %{{[0-9]+}}) : (!gccjit.int, !gccjit.int) -> !gccjit.ptr %a = memref.alloc (%arg0, %arg1) : memref return } func.func @baz() { - // CHECK: %[[V6:[0-9]+]] = gccjit.sizeof !gccjit.int : - // CHECK: %[[V7:[0-9]+]] = gccjit.binary mult(%[[V6]] : !gccjit.int, %{{[0-9]+}} : !gccjit.int) : !gccjit.int - // CHECK: %[[V8:[0-9]+]] = gccjit.const #gccjit.int<128> : !gccjit.int - // CHECK: %[[V9:[0-9]+]] = gccjit.binary plus(%[[V7]] : !gccjit.int, %[[V8]] : !gccjit.int) : !gccjit.int - // CHECK: %[[V10:[0-9]+]] = gccjit.call builtin @malloc(%[[V9]]) : (!gccjit.int) -> !gccjit.ptr - // CHECK: %[[V11:[0-9]+]] = gccjit.bitcast %[[V10]] : !gccjit.ptr to !gccjit.int - // CHECK: %[[V12:[0-9]+]] = gccjit.const #gccjit.int<1> : !gccjit.int - // CHECK: %[[V13:[0-9]+]] = gccjit.binary minus(%[[V8]] : !gccjit.int, %[[V12]] : !gccjit.int) : !gccjit.int - // CHECK: %[[V14:[0-9]+]] = gccjit.binary plus(%[[V11]] : !gccjit.int, %[[V13]] : !gccjit.int) : !gccjit.int - // CHECK: %[[V15:[0-9]+]] = gccjit.binary modulo(%[[V14]] : !gccjit.int, %[[V8]] : !gccjit.int) : !gccjit.int - // CHECK: %[[V16:[0-9]+]] = gccjit.binary minus(%[[V14]] : !gccjit.int, %[[V15]] : !gccjit.int) : !gccjit.int - // CHECK: %[[V17:[0-9]+]] = gccjit.bitcast %[[V16]] : !gccjit.int to !gccjit.ptr> + // CHECK: gccjit.call builtin @aligned_alloc(%{{[0-9]+}}, %{{[0-9]+}}) : (!gccjit.int, !gccjit.int) -> !gccjit.ptr %a = memref.alloc () {alignment = 128} : memref<133x723x1xi128> return } diff --git a/test/lowering/alloca.mlir b/test/lowering/alloca.mlir index af74edd..3e3dfe8 100644 --- a/test/lowering/alloca.mlir +++ b/test/lowering/alloca.mlir @@ -4,50 +4,19 @@ module @test { func.func @foo() { - // CHECK: %[[V0:[0-9]+]] = gccjit.expr { - // CHECK: %[[V1:[0-9]+]] = gccjit.const #gccjit.int<100> : !gccjit.int - // CHECK: %[[V2:[0-9]+]] = gccjit.const #gccjit.int<100> : !gccjit.int - // CHECK: %[[V3:[0-9]+]] = gccjit.const #gccjit.int<1> : !gccjit.int - // CHECK: %[[V4:[0-9]+]] = gccjit.const #gccjit.int<10000> : !gccjit.int - // CHECK: %[[V5:[0-9]+]] = gccjit.sizeof !gccjit.fp : - // CHECK: %[[V6:[0-9]+]] = gccjit.binary mult(%[[V5]] : !gccjit.int, %[[V4]] : !gccjit.int) : !gccjit.int - // CHECK: %[[V7:[0-9]+]] = gccjit.call builtin @alloca(%[[V6]]) : (!gccjit.int) -> !gccjit.ptr - // CHECK: %[[V8:[0-9]+]] = gccjit.bitcast %[[V7]] : !gccjit.ptr to !gccjit.ptr> - // CHECK: %[[V9:[0-9]+]] = gccjit.new_array , 2>[%[[V1]] : !gccjit.int, %[[V2]] : !gccjit.int] - // CHECK: %[[V10:[0-9]+]] = gccjit.new_array , 2>[%[[V2]] : !gccjit.int, %[[V3]] : !gccjit.int] - // CHECK: %[[V11:[0-9]+]] = gccjit.const #gccjit.int<0> : !gccjit.int - // CHECK: %[[V12:[0-9]+]] = gccjit.new_struct [0, 1, 2, 3, 4][%[[V8]], %[[V8]], %[[V11]], %[[V9]], %[[V10]]] : (!gccjit.ptr>, !gccjit.ptr>, !gccjit.int, !gccjit.array, 2>, !gccjit.array, 2>) -> !gccjit.struct<"memref<100x100xf32>" {#gccjit.field<"base" !gccjit.ptr>>, #gccjit.field<"aligned" !gccjit.ptr>>, #gccjit.field<"offset" !gccjit.int>, #gccjit.field<"sizes" !gccjit.array, 2>>, #gccjit.field<"strides" !gccjit.array, 2>>}> - // CHECK: gccjit.return %[[V12]] : !gccjit.struct<"memref<100x100xf32>" {#gccjit.field<"base" !gccjit.ptr>>, #gccjit.field<"aligned" !gccjit.ptr>>, #gccjit.field<"offset" !gccjit.int>, #gccjit.field<"sizes" !gccjit.array, 2>>, #gccjit.field<"strides" !gccjit.array, 2>>}> - // CHECK: } : !gccjit.struct<"memref<100x100xf32>" {#gccjit.field<"base" !gccjit.ptr>>, #gccjit.field<"aligned" !gccjit.ptr>>, #gccjit.field<"offset" !gccjit.int>, #gccjit.field<"sizes" !gccjit.array, 2>>, #gccjit.field<"strides" !gccjit.array, 2>>}> + // CHECK: gccjit.call builtin @alloca(%{{[0-9]+}}) : (!gccjit.int) -> !gccjit.ptr %a = memref.alloca () : memref<100x100xf32> return } func.func @bar(%arg0 : index) { - // CHECK: %[[V0:[0-9]+]] = builtin.unrealized_conversion_cast %{{[0-9a-z]+}} : index to !gccjit.int - // CHECK: %[[V1:[0-9]+]] = gccjit.expr { - // CHECK: %[[V2:[0-9]+]] = gccjit.const #gccjit.int<133> : !gccjit.int - // CHECK: %[[V3:[0-9]+]] = gccjit.const #gccjit.int<723> : !gccjit.int - // CHECK: %[[V4:[0-9]+]] = gccjit.const #gccjit.int<1> : !gccjit.int - // CHECK: %[[V5:[0-9]+]] = gccjit.binary mult(%[[V0]] : !gccjit.int, %[[V3]] : !gccjit.int) : !gccjit.int - // CHECK: %[[V6:[0-9]+]] = gccjit.binary mult(%[[V5]] : !gccjit.int, %[[V2]] : !gccjit.int) : !gccjit.int - // CHECK: %[[V7:[0-9]+]] = gccjit.sizeof !gccjit.fp : - // CHECK: %[[V8:[0-9]+]] = gccjit.binary mult(%[[V7]] : !gccjit.int, %[[V6]] : !gccjit.int) : !gccjit.int - // CHECK: %[[V9:[0-9]+]] = gccjit.call builtin @alloca(%[[V8]]) : (!gccjit.int) -> !gccjit.ptr - // CHECK: %[[V10:[0-9]+]] = gccjit.bitcast %[[V9]] : !gccjit.ptr to !gccjit.ptr> - // CHECK: %[[V11:[0-9]+]] = gccjit.new_array , 3>[%[[V2]] : !gccjit.int, %[[V3]] : !gccjit.int, %[[V0]] : !gccjit.int] - // CHECK: %[[V12:[0-9]+]] = gccjit.new_array , 3>[%[[V5]] : !gccjit.int, %[[V0]] : !gccjit.int, %[[V4]] : !gccjit.int] - // CHECK: %[[V13:[0-9]+]] = gccjit.const #gccjit.int<0> : !gccjit.int - // CHECK: %[[V14:[0-9]+]] = gccjit.new_struct [0, 1, 2, 3, 4][%[[V10]], %[[V10]], %[[V13]], %[[V11]], %[[V12]]] : (!gccjit.ptr>, !gccjit.ptr>, !gccjit.int, !gccjit.array, 3>, !gccjit.array, 3>) -> !gccjit.struct<"memref<133x723x?xf32>" {#gccjit.field<"base" !gccjit.ptr>>, #gccjit.field<"aligned" !gccjit.ptr>>, #gccjit.field<"offset" !gccjit.int>, #gccjit.field<"sizes" !gccjit.array, 3>>, #gccjit.field<"strides" !gccjit.array, 3>>}> - // CHECK: gccjit.return %[[V14]] : !gccjit.struct<"memref<133x723x?xf32>" {#gccjit.field<"base" !gccjit.ptr>>, #gccjit.field<"aligned" !gccjit.ptr>>, #gccjit.field<"offset" !gccjit.int>, #gccjit.field<"sizes" !gccjit.array, 3>>, #gccjit.field<"strides" !gccjit.array, 3>>}> - // CHECK: } : !gccjit.struct<"memref<133x723x?xf32>" {#gccjit.field<"base" !gccjit.ptr>>, #gccjit.field<"aligned" !gccjit.ptr>>, #gccjit.field<"offset" !gccjit.int>, #gccjit.field<"sizes" !gccjit.array, 3>>, #gccjit.field<"strides" !gccjit.array, 3>>}> + // // CHECK: gccjit.call builtin @alloca(%{{[0-9]+}}) : (!gccjit.int) -> !gccjit.ptr %a = memref.alloca (%arg0) : memref<133x723x?xf32> return } func.func @baz(%arg0 : index) { - // CHECK: %[[V:[0-9]+]] = gccjit.const #gccjit.int<128> : !gccjit.int - // CHECK: gccjit.call builtin @alloca_with_align(%{{[0-9]+}}, %[[V]]) : (!gccjit.int, !gccjit.int) -> !gccjit.ptr + // CHECK: gccjit.call builtin @alloca_with_align(%{{[0-9]+}}, %{{[0-9]+}}) : (!gccjit.int, !gccjit.int) -> !gccjit.ptr %a = memref.alloca (%arg0) {alignment = 128} : memref<133x723x?xf32> return }