diff options
author | Mehdi Amini <aminim@google.com> | 2019-08-12 19:12:42 -0700 |
---|---|---|
committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-08-12 19:13:12 -0700 |
commit | 926fb685deadfed2042163145ac52311914bf5c2 (patch) | |
tree | 6af2d1fc60691dbd3e216fd38180795470c07654 /mlir/lib/Transforms/LoopInvariantCodeMotion.cpp | |
parent | 532c652d6c5490f9d5380fc7d40837e6414c2ef8 (diff) | |
download | llvm-926fb685deadfed2042163145ac52311914bf5c2.zip llvm-926fb685deadfed2042163145ac52311914bf5c2.tar.gz llvm-926fb685deadfed2042163145ac52311914bf5c2.tar.bz2 |
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
Diffstat (limited to 'mlir/lib/Transforms/LoopInvariantCodeMotion.cpp')
-rw-r--r-- | mlir/lib/Transforms/LoopInvariantCodeMotion.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp b/mlir/lib/Transforms/LoopInvariantCodeMotion.cpp index d8b5b2d..09fe9af 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<FunctionPassBase> mlir::createLoopInvariantCodeMotionPass() { + return llvm::make_unique<LoopInvariantCodeMotion>(); } // Returns true if the individual op is loop invariant. |