summaryrefslogtreecommitdiffstats
path: root/mlir/lib/Conversion/LoopsToGPU
diff options
context:
space:
mode:
authorMehdi Amini <aminim@google.com>2019-08-12 19:12:42 -0700
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-08-12 19:13:12 -0700
commit926fb685deadfed2042163145ac52311914bf5c2 (patch)
tree6af2d1fc60691dbd3e216fd38180795470c07654 /mlir/lib/Conversion/LoopsToGPU
parent532c652d6c5490f9d5380fc7d40837e6414c2ef8 (diff)
downloadbcm5719-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/Conversion/LoopsToGPU')
-rw-r--r--mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp b/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp
index 7c785b5c995..36869b87f1a 100644
--- a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp
+++ b/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp
@@ -66,13 +66,14 @@ struct ForLoopMapper : public FunctionPass<ForLoopMapper> {
};
} // namespace
-FunctionPassBase *mlir::createSimpleLoopsToGPUPass(unsigned numBlockDims,
- unsigned numThreadDims) {
- return new ForLoopMapper(numBlockDims, numThreadDims);
+std::unique_ptr<FunctionPassBase>
+mlir::createSimpleLoopsToGPUPass(unsigned numBlockDims,
+ unsigned numThreadDims) {
+ return llvm::make_unique<ForLoopMapper>(numBlockDims, numThreadDims);
}
static PassRegistration<ForLoopMapper>
registration(PASS_NAME, "Convert top-level loops to GPU kernels", [] {
- return new ForLoopMapper(clNumBlockDims.getValue(),
- clNumThreadDims.getValue());
+ return llvm::make_unique<ForLoopMapper>(clNumBlockDims.getValue(),
+ clNumThreadDims.getValue());
});
OpenPOWER on IntegriCloud