From 926fb685deadfed2042163145ac52311914bf5c2 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Mon, 12 Aug 2019 19:12:42 -0700 Subject: Express ownership transfer in PassManager API through std::unique_ptr (NFC) Since raw pointers are always passed around for IR construct without implying any ownership transfer, it can be error prone to have implicit ownership transferred the same way. For example this code can seem harmless: Pass *pass = .... pm.addPass(pass); pm.addPass(pass); pm.run(module); PiperOrigin-RevId: 263053082 --- mlir/lib/Transforms/LoopInvariantCodeMotion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp') diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp index d8b5b2d8b2c..09fe9afe808 100644 --- a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp +++ b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp @@ -76,8 +76,8 @@ static bool isMemRefDereferencingOp(Operation &op) { return false; } -FunctionPassBase *mlir::createLoopInvariantCodeMotionPass() { - return new LoopInvariantCodeMotion(); +std::unique_ptr mlir::createLoopInvariantCodeMotionPass() { + return llvm::make_unique(); } // Returns true if the individual op is loop invariant. -- cgit v1.2.3