[Mlir-commits] [mlir] 52e2552 - [mlir][Linalg] Fix incorrect erase order

Nicolas Vasilache llvmlistbot at llvm.org
Mon Jan 25 06:13:45 PST 2021


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();
 }


        


More information about the Mlir-commits mailing list