Skip to content

Commit 52e2552

Browse files
[mlir][Linalg] Fix incorrect erase order
1 parent d462aa5 commit 52e2552

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,14 @@ LogicalResult mlir::linalg::hoistPaddingOnTensors(SimplePadOp &simplePadOp,
595595
b.create<SubTensorOp>(loc, simplePadOp.getResultType(), packedTensor,
596596
offsets, sizes, strides)
597597
->getResult(0));
598-
simplePadOp.erase();
598+
599+
Operation *toErase = simplePadOp;
599600

600601
// Make the newly cloned `simplePadOp` available to the caller.
601602
simplePadOp =
602603
cast<SimplePadOp>(bvm.lookup(simplePadOp.result()).getDefiningOp());
603604

605+
toErase->erase();
606+
604607
return success();
605608
}

0 commit comments

Comments
 (0)