[mlir][sparse] misc code cleanup
* Flattening/simplifying some nested conditionals * const-ifying some local variables Depends On D143800 Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D143949
This commit is contained in:
@@ -1414,20 +1414,18 @@ public:
|
||||
createOrFoldDimCall(rewriter, loc, srcTp, adaptedOp, concatDim);
|
||||
offset = rewriter.create<arith::AddIOp>(loc, offset, curDim);
|
||||
}
|
||||
if (dstTp.hasEncoding()) {
|
||||
if (!allDense) {
|
||||
// In sparse output case, the destination holds the COO.
|
||||
Value coo = dst;
|
||||
dst = params.genNewCall(Action::kFromCOO, coo);
|
||||
// Release resources.
|
||||
genDelCOOCall(rewriter, loc, elemTp, coo);
|
||||
} else {
|
||||
dst = dstTensor;
|
||||
}
|
||||
rewriter.replaceOp(op, dst);
|
||||
} else {
|
||||
if (!dstTp.hasEncoding()) {
|
||||
rewriter.replaceOpWithNewOp<bufferization::ToTensorOp>(
|
||||
op, dstTp.getRankedTensorType(), dst);
|
||||
} else if (allDense) {
|
||||
rewriter.replaceOp(op, dstTensor);
|
||||
} else {
|
||||
// In sparse output case, the destination holds the COO.
|
||||
Value coo = dst;
|
||||
dst = params.genNewCall(Action::kFromCOO, coo);
|
||||
// Release resources.
|
||||
genDelCOOCall(rewriter, loc, elemTp, coo);
|
||||
rewriter.replaceOp(op, dst);
|
||||
}
|
||||
return success();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user