[mlir][sparse] Do not access operation after it was replaced (#146546)

Accessing an erased operation will no longer work during a One-Shot
Dialect Conversion.
This commit is contained in:
Matthias Springer
2025-07-01 21:39:54 +02:00
committed by GitHub
parent 119292c40b
commit d480359420

View File

@@ -729,9 +729,9 @@ public:
createFuncCall(rewriter, loc, name, {},
{tensor, lvlCoords, values, filled, added, count},
EmitCInterface::On);
Operation *parent = getTop(op);
rewriter.replaceOp(op, adaptor.getTensor());
// Deallocate the buffers on exit of the loop nest.
Operation *parent = getTop(op);
rewriter.setInsertionPointAfter(parent);
rewriter.create<memref::DeallocOp>(loc, values);
rewriter.create<memref::DeallocOp>(loc, filled);