[mlir][sparse] Fix problems in creating complex zero for initialization.

Reviewed By: aartbik, wrengr

Differential Revision: https://reviews.llvm.org/D139591
This commit is contained in:
bixia1
2022-12-07 16:14:22 -08:00
parent 23e1078a2f
commit ea4be70cea
4 changed files with 6 additions and 8 deletions

View File

@@ -235,8 +235,7 @@ static Value createAllocation(OpBuilder &builder, Location loc,
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;