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

Nicolas Vasilache via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jan 25 06:18:12 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 llvm-branch-commits mailing list