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/LoopTiling.cpp | |
| parent | 532c652d6c5490f9d5380fc7d40837e6414c2ef8 (diff) | |
| download | bcm5719-llvm-926fb685deadfed2042163145ac52311914bf5c2.tar.gz bcm5719-llvm-926fb685deadfed2042163145ac52311914bf5c2.zip | |
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/LoopTiling.cpp')
| -rw-r--r-- | mlir/lib/Transforms/LoopTiling.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mlir/lib/Transforms/LoopTiling.cpp b/mlir/lib/Transforms/LoopTiling.cpp index 0a331cae100..d6ff9a94234 100644 --- a/mlir/lib/Transforms/LoopTiling.cpp +++ b/mlir/lib/Transforms/LoopTiling.cpp @@ -81,8 +81,9 @@ struct LoopTiling : public FunctionPass<LoopTiling> { /// Creates a pass to perform loop tiling on all suitable loop nests of a /// Function. -FunctionPassBase *mlir::createLoopTilingPass(uint64_t cacheSizeBytes) { - return new LoopTiling(cacheSizeBytes); +std::unique_ptr<FunctionPassBase> +mlir::createLoopTilingPass(uint64_t cacheSizeBytes) { + return llvm::make_unique<LoopTiling>(cacheSizeBytes); } // Move the loop body of AffineForOp 'src' from 'src' into the specified |

