rewriter.create<memref::ReallocOp>(loc, bufferType, buffer, capacity);
if (enableBufferInitialization) {
Value fillSize = rewriter.create<arith::SubIOp>(loc, capacity, newSize);
- Value fillValue = rewriter.create<arith::ConstantOp>(
- loc, value.getType(), rewriter.getZeroAttr(value.getType()));
+ Value fillValue = constantZero(rewriter, loc, value.getType());
Value subBuffer = rewriter.create<memref::SubViewOp>(
loc, newBuffer, /*offset=*/ValueRange{newSize},
/*size=*/ValueRange{fillSize},
Value buffer = builder.create<memref::AllocOp>(loc, memRefType, sz);
Type elemType = memRefType.getElementType();
if (enableInit) {
- Value fillValue = builder.create<arith::ConstantOp>(
- loc, elemType, builder.getZeroAttr(elemType));
+ Value fillValue = constantZero(builder, loc, elemType);
builder.create<linalg::FillOp>(loc, fillValue, buffer);
}
return buffer;
// The following operations and dialects may be introduced by the
// codegen rules, and are therefore marked as legal.
target.addLegalOp<linalg::FillOp>();
- target.addLegalDialect<arith::ArithDialect,
- bufferization::BufferizationDialect,
- memref::MemRefDialect, scf::SCFDialect>();
+ target.addLegalDialect<
+ arith::ArithDialect, bufferization::BufferizationDialect,
+ complex::ComplexDialect, memref::MemRefDialect, scf::SCFDialect>();
target.addLegalOp<UnrealizedConversionCastOp>();
// Populate with rules and apply rewriting rules.
populateFunctionOpInterfaceTypeConversionPattern<func::FuncOp>(patterns,
// RUN: %{command}
//
// Do the same run, but now with direct IR generation.
-// REDEFINE: %{option} = enable-runtime-library=false
+// REDEFINE: %{option} = "enable-runtime-library=false enable-buffer-initialization=true"
// RUN: %{command}
#SparseVector = #sparse_tensor.encoding<{dimLevelType = ["compressed"]}>