Author: Nicolas Vasilache Date: 2021-01-25T14:04:06Z New Revision: 52e25523a98f1f6c0afeba7f29308b02761d8017
URL: https://github.com/llvm/llvm-project/commit/52e25523a98f1f6c0afeba7f29308b02761d8017 DIFF: https://github.com/llvm/llvm-project/commit/52e25523a98f1f6c0afeba7f29308b02761d8017.diff LOG: [mlir][Linalg] Fix incorrect erase order Added: Modified: mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp Removed: ################################################################################ diff --git a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp index 9ca1f6da43f6..5c67c8e61829 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp @@ -595,11 +595,14 @@ LogicalResult mlir::linalg::hoistPaddingOnTensors(SimplePadOp &simplePadOp, b.create<SubTensorOp>(loc, simplePadOp.getResultType(), packedTensor, offsets, sizes, strides) ->getResult(0)); - simplePadOp.erase(); + + Operation *toErase = simplePadOp; // Make the newly cloned `simplePadOp` available to the caller. simplePadOp = cast<SimplePadOp>(bvm.lookup(simplePadOp.result()).getDefiningOp()); + toErase->erase(); + return success(); } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits