aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mlir/examples/Linalg/Linalg3/include/linalg3/Transforms.h2
-rw-r--r--mlir/examples/Linalg/Linalg3/lib/Transforms.cpp4
-rw-r--r--mlir/examples/toy/Ch4/include/toy/Passes.h4
-rw-r--r--mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp4
-rw-r--r--mlir/examples/toy/Ch4/toyc.cpp1
-rw-r--r--mlir/examples/toy/Ch5/include/toy/Lowering.h4
-rw-r--r--mlir/examples/toy/Ch5/include/toy/Passes.h4
-rw-r--r--mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp4
-rw-r--r--mlir/examples/toy/Ch5/mlir/LateLowering.cpp4
-rw-r--r--mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp4
-rw-r--r--mlir/examples/toy/Ch5/toyc.cpp1
-rw-r--r--mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h6
-rw-r--r--mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h4
-rw-r--r--mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h6
-rw-r--r--mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h6
-rw-r--r--mlir/include/mlir/Dialect/GPU/Passes.h4
-rw-r--r--mlir/include/mlir/Dialect/QuantOps/Passes.h6
-rw-r--r--mlir/include/mlir/Dialect/SPIRV/Passes.h2
-rw-r--r--mlir/include/mlir/Linalg/Passes.h12
-rw-r--r--mlir/include/mlir/Pass/Pass.h6
-rw-r--r--mlir/include/mlir/Pass/PassManager.h6
-rw-r--r--mlir/include/mlir/Pass/PassRegistry.h7
-rw-r--r--mlir/include/mlir/Quantizer/Transforms/Passes.h6
-rw-r--r--mlir/include/mlir/Transforms/Passes.h48
-rw-r--r--mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp4
-rw-r--r--mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp5
-rw-r--r--mlir/lib/Conversion/GPUToCUDA/GenerateCubinAccessors.cpp4
-rw-r--r--mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp4
-rw-r--r--mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp11
-rw-r--r--mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp9
-rw-r--r--mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp5
-rw-r--r--mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp4
-rw-r--r--mlir/lib/Dialect/QuantOps/Transforms/ConvertConst.cpp4
-rw-r--r--mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp5
-rw-r--r--mlir/lib/Linalg/Transforms/Fusion.cpp6
-rw-r--r--mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp4
-rw-r--r--mlir/lib/Linalg/Transforms/LowerToLoops.cpp4
-rw-r--r--mlir/lib/Linalg/Transforms/Tiling.cpp6
-rw-r--r--mlir/lib/Pass/Pass.cpp26
-rw-r--r--mlir/lib/Pass/PassDetail.h8
-rw-r--r--mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp4
-rw-r--r--mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp4
-rw-r--r--mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp5
-rw-r--r--mlir/lib/Transforms/AffineDataCopyGeneration.cpp8
-rw-r--r--mlir/lib/Transforms/CSE.cpp4
-rw-r--r--mlir/lib/Transforms/Canonicalizer.cpp4
-rw-r--r--mlir/lib/Transforms/LoopCoalescing.cpp4
-rw-r--r--mlir/lib/Transforms/LoopFusion.cpp9
-rw-r--r--mlir/lib/Transforms/LoopInvariantCodeMotion.cpp4
-rw-r--r--mlir/lib/Transforms/LoopTiling.cpp5
-rw-r--r--mlir/lib/Transforms/LoopUnroll.cpp4
-rw-r--r--mlir/lib/Transforms/LoopUnrollAndJam.cpp5
-rw-r--r--mlir/lib/Transforms/LowerAffine.cpp4
-rw-r--r--mlir/lib/Transforms/LowerVectorTransfers.cpp4
-rw-r--r--mlir/lib/Transforms/MaterializeVectors.cpp4
-rw-r--r--mlir/lib/Transforms/MemRefDataFlowOpt.cpp4
-rw-r--r--mlir/lib/Transforms/PipelineDataTransfer.cpp4
-rw-r--r--mlir/lib/Transforms/SimplifyAffineStructures.cpp4
-rw-r--r--mlir/lib/Transforms/StripDebugInfo.cpp4
-rw-r--r--mlir/lib/Transforms/Vectorize.cpp4
-rw-r--r--mlir/test/lib/TestDialect/TestPatterns.cpp9
-rw-r--r--mlir/test/lib/Transforms/TestConstantFold.cpp4
-rw-r--r--mlir/test/lib/Transforms/TestLoopFusion.cpp4
-rw-r--r--mlir/test/lib/Transforms/TestLoopMapping.cpp2
-rw-r--r--mlir/test/lib/Transforms/TestLoopParametricTiling.cpp7
-rw-r--r--mlir/test/lib/Transforms/TestVectorizationUtils.cpp4
66 files changed, 217 insertions, 169 deletions
diff --git a/mlir/examples/Linalg/Linalg3/include/linalg3/Transforms.h b/mlir/examples/Linalg/Linalg3/include/linalg3/Transforms.h
index 4346b47..123d6af 100644
--- a/mlir/examples/Linalg/Linalg3/include/linalg3/Transforms.h
+++ b/mlir/examples/Linalg/Linalg3/include/linalg3/Transforms.h
@@ -73,7 +73,7 @@ void lowerToLoops(mlir::FuncOp f);
/// Creates a pass that rewrites linalg.load and linalg.store to affine.load and
/// affine.store operations.
-mlir::FunctionPassBase *createLowerLinalgLoadStorePass();
+std::unique_ptr<mlir::FunctionPassBase> createLowerLinalgLoadStorePass();
} // namespace linalg
diff --git a/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp b/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp
index 7fc4bb5..79fa4ca 100644
--- a/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp
+++ b/mlir/examples/Linalg/Linalg3/lib/Transforms.cpp
@@ -300,6 +300,6 @@ Rewriter<linalg::StoreOp>::matchAndRewrite(linalg::StoreOp store,
}
} // namespace
-FunctionPassBase *linalg::createLowerLinalgLoadStorePass() {
- return new LowerLinalgLoadStorePass();
+std::unique_ptr<FunctionPassBase> linalg::createLowerLinalgLoadStorePass() {
+ return llvm::make_unique<LowerLinalgLoadStorePass>();
}
diff --git a/mlir/examples/toy/Ch4/include/toy/Passes.h b/mlir/examples/toy/Ch4/include/toy/Passes.h
index dd73b95..93cf0d5 100644
--- a/mlir/examples/toy/Ch4/include/toy/Passes.h
+++ b/mlir/examples/toy/Ch4/include/toy/Passes.h
@@ -22,12 +22,14 @@
#ifndef MLIR_TUTORIAL_TOY_PASSES_H
#define MLIR_TUTORIAL_TOY_PASSES_H
+#include <memory>
+
namespace mlir {
class Pass;
} // namespace mlir
namespace toy {
-mlir::Pass *createShapeInferencePass();
+std::unique_ptr<mlir::Pass> createShapeInferencePass();
} // namespace toy
#endif // MLIR_TUTORIAL_TOY_PASSES_H
diff --git a/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp b/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp
index 5c258f1..4a6bf87 100644
--- a/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp
+++ b/mlir/examples/toy/Ch4/mlir/ShapeInferencePass.cpp
@@ -375,5 +375,7 @@ public:
} // end anonymous namespace
namespace toy {
-mlir::Pass *createShapeInferencePass() { return new ShapeInferencePass(); }
+std::unique_ptr<mlir::Pass> createShapeInferencePass() {
+ return llvm::make_unique<ShapeInferencePass>();
+}
} // namespace toy
diff --git a/mlir/examples/toy/Ch4/toyc.cpp b/mlir/examples/toy/Ch4/toyc.cpp
index a273c93..9e7a8a39 100644
--- a/mlir/examples/toy/Ch4/toyc.cpp
+++ b/mlir/examples/toy/Ch4/toyc.cpp
@@ -28,6 +28,7 @@
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Module.h"
#include "mlir/Parser.h"
+#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Transforms/Passes.h"
diff --git a/mlir/examples/toy/Ch5/include/toy/Lowering.h b/mlir/examples/toy/Ch5/include/toy/Lowering.h
index 362a342..4788ea3 100644
--- a/mlir/examples/toy/Ch5/include/toy/Lowering.h
+++ b/mlir/examples/toy/Ch5/include/toy/Lowering.h
@@ -35,10 +35,10 @@ class DialectConversion;
namespace toy {
/// Create a pass for lowering operations in the `Linalg` dialects, for a subset
/// of the Toy IR (matmul).
-mlir::Pass *createEarlyLoweringPass();
+std::unique_ptr<mlir::Pass> createEarlyLoweringPass();
/// Create a pass for the late lowering toward LLVM dialect.
-mlir::Pass *createLateLoweringPass();
+std::unique_ptr<mlir::Pass> createLateLoweringPass();
} // namespace toy
diff --git a/mlir/examples/toy/Ch5/include/toy/Passes.h b/mlir/examples/toy/Ch5/include/toy/Passes.h
index dd73b95..93cf0d5 100644
--- a/mlir/examples/toy/Ch5/include/toy/Passes.h
+++ b/mlir/examples/toy/Ch5/include/toy/Passes.h
@@ -22,12 +22,14 @@
#ifndef MLIR_TUTORIAL_TOY_PASSES_H
#define MLIR_TUTORIAL_TOY_PASSES_H
+#include <memory>
+
namespace mlir {
class Pass;
} // namespace mlir
namespace toy {
-mlir::Pass *createShapeInferencePass();
+std::unique_ptr<mlir::Pass> createShapeInferencePass();
} // namespace toy
#endif // MLIR_TUTORIAL_TOY_PASSES_H
diff --git a/mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp b/mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp
index 015a3fd..96230fd 100644
--- a/mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp
+++ b/mlir/examples/toy/Ch5/mlir/EarlyLowering.cpp
@@ -142,5 +142,7 @@ struct EarlyLoweringPass : public FunctionPass<EarlyLoweringPass> {
} // end anonymous namespace
namespace toy {
-Pass *createEarlyLoweringPass() { return new EarlyLoweringPass(); }
+std::unique_ptr<mlir::Pass> createEarlyLoweringPass() {
+ return llvm::make_unique<EarlyLoweringPass>();
+}
} // namespace toy
diff --git a/mlir/examples/toy/Ch5/mlir/LateLowering.cpp b/mlir/examples/toy/Ch5/mlir/LateLowering.cpp
index 3b6bfc9..6135e27 100644
--- a/mlir/examples/toy/Ch5/mlir/LateLowering.cpp
+++ b/mlir/examples/toy/Ch5/mlir/LateLowering.cpp
@@ -458,5 +458,7 @@ struct LateLoweringPass : public ModulePass<LateLoweringPass> {
} // end anonymous namespace
namespace toy {
-Pass *createLateLoweringPass() { return new LateLoweringPass(); }
+std::unique_ptr<mlir::Pass> createLateLoweringPass() {
+ return llvm::make_unique<LateLoweringPass>();
+}
} // namespace toy
diff --git a/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp b/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp
index cef2939..6437c0b 100644
--- a/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp
+++ b/mlir/examples/toy/Ch5/mlir/ShapeInferencePass.cpp
@@ -375,5 +375,7 @@ public:
} // end anonymous namespace
namespace toy {
-mlir::Pass *createShapeInferencePass() { return new ShapeInferencePass(); }
+std::unique_ptr<mlir::Pass> createShapeInferencePass() {
+ return llvm::make_unique<ShapeInferencePass>();
+}
} // namespace toy
diff --git a/mlir/examples/toy/Ch5/toyc.cpp b/mlir/examples/toy/Ch5/toyc.cpp
index 1d80c3c..a21eda7 100644
--- a/mlir/examples/toy/Ch5/toyc.cpp
+++ b/mlir/examples/toy/Ch5/toyc.cpp
@@ -32,6 +32,7 @@
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Module.h"
#include "mlir/Parser.h"
+#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Target/LLVMIR.h"
#include "mlir/Transforms/Passes.h"
diff --git a/mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h b/mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h
index b19fb53..bd1a3fe 100644
--- a/mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h
+++ b/mlir/include/mlir/Conversion/GPUToCUDA/GPUToCUDAPass.h
@@ -39,7 +39,7 @@ using CubinGenerator = std::function<OwnedCubin(const std::string &, FuncOp &)>;
/// attached as a string attribute named 'nvvm.cubin' to the kernel function.
/// After the transformation, the body of the kernel function is removed (i.e.,
/// it is turned into a declaration).
-ModulePassBase *
+std::unique_ptr<ModulePassBase>
createConvertGPUKernelToCubinPass(CubinGenerator cubinGenerator);
/// Creates a pass to convert a gpu.launch_func operation into a sequence of
@@ -48,11 +48,11 @@ createConvertGPUKernelToCubinPass(CubinGenerator cubinGenerator);
/// This pass does not generate code to call CUDA directly but instead uses a
/// small wrapper library that exports a stable and conveniently typed ABI
/// ontop of CUDA.
-ModulePassBase *createConvertGpuLaunchFuncToCudaCallsPass();
+std::unique_ptr<ModulePassBase> createConvertGpuLaunchFuncToCudaCallsPass();
/// Creates a pass to augment a module with getter functions for all contained
/// cubins as encoded via the 'nvvm.cubin' attribute.
-ModulePassBase *createGenerateCubinAccessorPass();
+std::unique_ptr<ModulePassBase> createGenerateCubinAccessorPass();
} // namespace mlir
#endif // MLIR_CONVERSION_GPUTOCUDA_GPUTOCUDAPASS_H_
diff --git a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
index b53549f..f1c8601 100644
--- a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
+++ b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h
@@ -17,11 +17,13 @@
#ifndef MLIR_CONVERSION_GPUTONVVM_GPUTONVVMPASS_H_
#define MLIR_CONVERSION_GPUTONVVM_GPUTONVVMPASS_H_
+#include <memory>
+
namespace mlir {
struct FunctionPassBase;
/// Creates a pass that lowers GPU dialect operations to NVVM counterparts.
-FunctionPassBase *createLowerGpuOpsToNVVMOpsPass();
+std::unique_ptr<FunctionPassBase> createLowerGpuOpsToNVVMOpsPass();
} // namespace mlir
diff --git a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h b/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h
index 52f0dd4..3d32c36 100644
--- a/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h
+++ b/mlir/include/mlir/Conversion/LoopsToGPU/LoopsToGPUPass.h
@@ -17,6 +17,8 @@
#ifndef MLIR_CONVERSION_LOOPSTOGPU_LOOPSTOGPUPASS_H_
#define MLIR_CONVERSION_LOOPSTOGPU_LOOPSTOGPUPASS_H_
+#include <memory>
+
namespace mlir {
class FunctionPassBase;
@@ -28,8 +30,8 @@ class FunctionPassBase;
/// parallelization is performed, it is under the responsibility of the caller
/// to strip-mine the loops and to perform the dependence analysis before
/// calling the conversion.
-FunctionPassBase *createSimpleLoopsToGPUPass(unsigned numBlockDims,
- unsigned numThreadDims);
+std::unique_ptr<FunctionPassBase>
+createSimpleLoopsToGPUPass(unsigned numBlockDims, unsigned numThreadDims);
} // namespace mlir
#endif // MLIR_CONVERSION_LOOPSTOGPU_LOOPSTOGPUPASS_H_
diff --git a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
index 941e382..a08b2fb 100644
--- a/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
+++ b/mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVMPass.h
@@ -57,12 +57,12 @@ void populateStdToLLVMConversionPatterns(LLVMTypeConverter &converter,
OwningRewritePatternList &patterns);
/// Creates a pass to convert the Standard dialect into the LLVMIR dialect.
-ModulePassBase *createConvertToLLVMIRPass();
+std::unique_ptr<ModulePassBase> createConvertToLLVMIRPass();
/// Creates a pass to convert operations to the LLVMIR dialect. The conversion
/// is defined by a list of patterns and a type converter that will be obtained
/// during the pass using the provided callbacks.
-ModulePassBase *
+std::unique_ptr<ModulePassBase>
createConvertToLLVMIRPass(LLVMPatternListFiller patternListFiller,
LLVMTypeConverterMaker typeConverterMaker);
@@ -71,7 +71,7 @@ createConvertToLLVMIRPass(LLVMPatternListFiller patternListFiller,
/// callback and an optional type conversion class, an instance is created
/// during the pass.
template <typename TypeConverter = LLVMTypeConverter>
-ModulePassBase *
+std::unique_ptr<ModulePassBase>
createConvertToLLVMIRPass(LLVMPatternListFiller patternListFiller) {
return createConvertToLLVMIRPass(patternListFiller, [](MLIRContext *context) {
return llvm::make_unique<TypeConverter>(context);
diff --git a/mlir/include/mlir/Dialect/GPU/Passes.h b/mlir/include/mlir/Dialect/GPU/Passes.h
index f9b569d..d562b58 100644
--- a/mlir/include/mlir/Dialect/GPU/Passes.h
+++ b/mlir/include/mlir/Dialect/GPU/Passes.h
@@ -22,11 +22,13 @@
#ifndef MLIR_DIALECT_GPU_PASSES_H_
#define MLIR_DIALECT_GPU_PASSES_H_
+#include <memory>
+
namespace mlir {
class ModulePassBase;
-ModulePassBase *createGpuKernelOutliningPass();
+std::unique_ptr<ModulePassBase> createGpuKernelOutliningPass();
} // namespace mlir
diff --git a/mlir/include/mlir/Dialect/QuantOps/Passes.h b/mlir/include/mlir/Dialect/QuantOps/Passes.h
index 6b647a8..1d43f70 100644
--- a/mlir/include/mlir/Dialect/QuantOps/Passes.h
+++ b/mlir/include/mlir/Dialect/QuantOps/Passes.h
@@ -25,6 +25,8 @@
#ifndef MLIR_DIALECT_QUANTOPS_PASSES_H
#define MLIR_DIALECT_QUANTOPS_PASSES_H
+#include <memory>
+
namespace mlir {
class FunctionPassBase;
@@ -32,14 +34,14 @@ namespace quant {
/// Creates a pass that converts quantization simulation operations (i.e.
/// FakeQuant and those like it) to casts into/out of supported QuantizedTypes.
-FunctionPassBase *createConvertSimulatedQuantPass();
+std::unique_ptr<FunctionPassBase> createConvertSimulatedQuantPass();
/// Creates a pass that converts constants followed by a qbarrier to a
/// constant whose value is quantized. This is typically one of the last
/// passes done when lowering to express actual quantized arithmetic in a
/// low level representation. Because it modifies the constant, it is
/// destructive and cannot be undone.
-FunctionPassBase *createConvertConstPass();
+std::unique_ptr<FunctionPassBase> createConvertConstPass();
} // namespace quant
} // namespace mlir
diff --git a/mlir/include/mlir/Dialect/SPIRV/Passes.h b/mlir/include/mlir/Dialect/SPIRV/Passes.h
index e896da7..85f4f79 100644
--- a/mlir/include/mlir/Dialect/SPIRV/Passes.h
+++ b/mlir/include/mlir/Dialect/SPIRV/Passes.h
@@ -27,7 +27,7 @@
namespace mlir {
namespace spirv {
-ModulePassBase *createConvertStandardToSPIRVPass();
+std::unique_ptr<ModulePassBase> createConvertStandardToSPIRVPass();
} // namespace spirv
} // namespace mlir
diff --git a/mlir/include/mlir/Linalg/Passes.h b/mlir/include/mlir/Linalg/Passes.h
index 0294149..57dd09c 100644
--- a/mlir/include/mlir/Linalg/Passes.h
+++ b/mlir/include/mlir/Linalg/Passes.h
@@ -30,14 +30,16 @@ class FunctionPassBase;
class ModulePassBase;
namespace linalg {
-FunctionPassBase *createLinalgFusionPass(ArrayRef<int64_t> tileSizes = {});
+std::unique_ptr<FunctionPassBase>
+createLinalgFusionPass(ArrayRef<int64_t> tileSizes = {});
-FunctionPassBase *createLinalgTilingPass(ArrayRef<int64_t> tileSizes = {},
- bool promoteViews = false);
+std::unique_ptr<FunctionPassBase>
+createLinalgTilingPass(ArrayRef<int64_t> tileSizes = {},
+ bool promoteViews = false);
-FunctionPassBase *createLowerLinalgToLoopsPass();
+std::unique_ptr<FunctionPassBase> createLowerLinalgToLoopsPass();
-ModulePassBase *createLowerLinalgToLLVMPass();
+std::unique_ptr<ModulePassBase> createLowerLinalgToLLVMPass();
} // namespace linalg
} // namespace mlir
diff --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h
index b1531a3..f5c8d8b 100644
--- a/mlir/include/mlir/Pass/Pass.h
+++ b/mlir/include/mlir/Pass/Pass.h
@@ -104,7 +104,7 @@ protected:
virtual void runOnFunction() = 0;
/// A clone method to create a copy of this pass.
- virtual FunctionPassBase *clone() const = 0;
+ virtual std::unique_ptr<FunctionPassBase> clone() const = 0;
/// Return the current function being transformed.
FuncOp getFunction() { return getPassState().irAndPassFailed.getPointer(); }
@@ -259,8 +259,8 @@ struct FunctionPass : public detail::PassModel<FuncOp, T, FunctionPassBase> {
}
/// A clone method to create a copy of this pass.
- FunctionPassBase *clone() const override {
- return new T(*static_cast<const T *>(this));
+ std::unique_ptr<FunctionPassBase> clone() const override {
+ return llvm::make_unique<T>(*static_cast<const T *>(this));
}
};
diff --git a/mlir/include/mlir/Pass/PassManager.h b/mlir/include/mlir/Pass/PassManager.h
index 68dfeb0..b01445e 100644
--- a/mlir/include/mlir/Pass/PassManager.h
+++ b/mlir/include/mlir/Pass/PassManager.h
@@ -71,16 +71,16 @@ public:
/// Add an opaque pass pointer to the current manager. This takes ownership
/// over the provided pass pointer.
- void addPass(Pass *pass);
+ void addPass(std::unique_ptr<Pass> pass);
/// Add a module pass to the current manager. This takes ownership over the
/// provided pass pointer.
- void addPass(ModulePassBase *pass);
+ void addPass(std::unique_ptr<ModulePassBase> pass);
/// Add a function pass to the current manager. This takes ownership over the
/// provided pass pointer. This will automatically create a function pass
/// executor if necessary.
- void addPass(FunctionPassBase *pass);
+ void addPass(std::unique_ptr<FunctionPassBase> pass);
//===--------------------------------------------------------------------===//
// Instrumentations
diff --git a/mlir/include/mlir/Pass/PassRegistry.h b/mlir/include/mlir/Pass/PassRegistry.h
index ea0fbbe..bd108f3 100644
--- a/mlir/include/mlir/Pass/PassRegistry.h
+++ b/mlir/include/mlir/Pass/PassRegistry.h
@@ -29,6 +29,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include <functional>
+#include <memory>
namespace mlir {
class Pass;
@@ -37,7 +38,7 @@ class PassManager;
/// A registry function that adds passes to the given pass manager.
using PassRegistryFunction = std::function<void(PassManager &)>;
-using PassAllocatorFunction = std::function<Pass *()>;
+using PassAllocatorFunction = std::function<std::unique_ptr<Pass>()>;
/// A special type used by transformation passes to provide an address that can
/// act as a unique identifier during pass registration.
@@ -120,7 +121,9 @@ template <typename ConcretePass> struct PassRegistration {
}
PassRegistration(StringRef arg, StringRef description) {
- PassAllocatorFunction constructor = [] { return new ConcretePass(); };
+ PassAllocatorFunction constructor = [] {
+ return llvm::make_unique<ConcretePass>();
+ };
registerPass(arg, description, PassID::getID<ConcretePass>(), constructor);
}
};
diff --git a/mlir/include/mlir/Quantizer/Transforms/Passes.h b/mlir/include/mlir/Quantizer/Transforms/Passes.h
index 0d7b4cb..f894ea8 100644
--- a/mlir/include/mlir/Quantizer/Transforms/Passes.h
+++ b/mlir/include/mlir/Quantizer/Transforms/Passes.h
@@ -33,17 +33,17 @@ class TargetConfiguration;
/// Creates a pass that infers quantized types based on metadata discovered
/// in the computation.
-ModulePassBase *
+std::unique_ptr<ModulePassBase>
createInferQuantizedTypesPass(SolverContext &solverContext,
const TargetConfiguration &config);
/// Creates a pass which removes any instrumentation and hint ops which have
/// no effect on final runtime.
-FunctionPassBase *createRemoveInstrumentationPass();
+std::unique_ptr<FunctionPassBase> createRemoveInstrumentationPass();
/// Adds default (dummy) statistics to ops that can benefit from runtime stats.
/// Meant for testing.
-FunctionPassBase *createAddDefaultStatsPass();
+std::unique_ptr<FunctionPassBase> createAddDefaultStatsPass();
} // namespace quantizer
} // namespace mlir
diff --git a/mlir/include/mlir/Transforms/Passes.h b/mlir/include/mlir/Transforms/Passes.h
index ee36517..693c7b0 100644
--- a/mlir/include/mlir/Transforms/Passes.h
+++ b/mlir/include/mlir/Transforms/Passes.h
@@ -37,25 +37,25 @@ class ModulePassBase;
/// top-down constant folding functionality; it is intended to be used for
/// testing purpose. Use Canonicalizer pass, which exploits more simplification
/// opportunties exposed by constant folding, for the general cases.
-FunctionPassBase *createTestConstantFoldPass();
+std::unique_ptr<FunctionPassBase> createTestConstantFoldPass();
/// Creates an instance of the Canonicalizer pass.
-FunctionPassBase *createCanonicalizerPass();
+std::unique_ptr<FunctionPassBase> createCanonicalizerPass();
/// Creates a pass to perform common sub expression elimination.
-FunctionPassBase *createCSEPass();
+std::unique_ptr<FunctionPassBase> createCSEPass();
/// Creates a pass to vectorize loops, operations and data types using a
/// target-independent, n-D super-vector abstraction.
-FunctionPassBase *
+std::unique_ptr<FunctionPassBase>
createVectorizePass(llvm::ArrayRef<int64_t> virtualVectorSize);
/// Creates a pass to allow independent testing of vectorizer functionality with
/// FileCheck.
-FunctionPassBase *createVectorizerTestPass();
+std::unique_ptr<FunctionPassBase> createVectorizerTestPass();
/// Creates a pass to lower super-vectors to target-dependent HW vectors.
-FunctionPassBase *
+std::unique_ptr<FunctionPassBase>
createMaterializeVectorsPass(llvm::ArrayRef<int64_t> vectorSize);
/// Creates a loop unrolling pass with the provided parameters.
@@ -64,71 +64,73 @@ createMaterializeVectorsPass(llvm::ArrayRef<int64_t> vectorSize);
/// factors supplied through other means. If -1 is passed as the unrollFactor
/// and no callback is provided, anything passed from the command-line (if at
/// all) or the default unroll factor is used (LoopUnroll:kDefaultUnrollFactor).
-FunctionPassBase *createLoopUnrollPass(
+std::unique_ptr<FunctionPassBase> createLoopUnrollPass(
int unrollFactor = -1, int unrollFull = -1,
const std::function<unsigned(AffineForOp)> &getUnrollFactor = nullptr);
/// Creates a loop unroll jam pass to unroll jam by the specified factor. A
/// factor of -1 lets the pass use the default factor or the one on the command
/// line if provided.
-FunctionPassBase *createLoopUnrollAndJamPass(int unrollJamFactor = -1);
+std::unique_ptr<FunctionPassBase>
+createLoopUnrollAndJamPass(int unrollJamFactor = -1);
/// Creates an simplification pass for affine structures.
-FunctionPassBase *createSimplifyAffineStructuresPass();
+std::unique_ptr<FunctionPassBase> createSimplifyAffineStructuresPass();
/// Creates a loop fusion pass which fuses loops. Buffers of size less than or
/// equal to `localBufSizeThreshold` are promoted to memory space
/// `fastMemorySpace'.
-FunctionPassBase *createLoopFusionPass(unsigned fastMemorySpace = 0,
- uint64_t localBufSizeThreshold = 0,
- bool maximalFusion = false);
+std::unique_ptr<FunctionPassBase>
+createLoopFusionPass(unsigned fastMemorySpace = 0,
+ uint64_t localBufSizeThreshold = 0,
+ bool maximalFusion = false);
/// Creates a loop invariant code motion pass that hoists loop invariant
/// instructions out of the loop.
-FunctionPassBase *createLoopInvariantCodeMotionPass();
+std::unique_ptr<FunctionPassBase> createLoopInvariantCodeMotionPass();
/// Creates a pass to pipeline explicit movement of data across levels of the
/// memory hierarchy.
-FunctionPassBase *createPipelineDataTransferPass();
+std::unique_ptr<FunctionPassBase> createPipelineDataTransferPass();
/// Lowers affine control flow operations (ForStmt, IfStmt and AffineApplyOp)
/// to equivalent lower-level constructs (flow of basic blocks and arithmetic
/// primitives).
-FunctionPassBase *createLowerAffinePass();
+std::unique_ptr<FunctionPassBase> createLowerAffinePass();
/// Creates a pass to perform tiling on loop nests.
-FunctionPassBase *createLoopTilingPass(uint64_t cacheSizeBytes);
+std::unique_ptr<FunctionPassBase> createLoopTilingPass(uint64_t cacheSizeBytes);
/// Creates a pass that performs parametric tiling so that the outermost loops
/// have the given fixed number of iterations. Assumes outermost loop nests
/// are permutable.
-FunctionPassBase *
+std::unique_ptr<FunctionPassBase>
createSimpleParametricTilingPass(ArrayRef<int64_t> outerLoopSizes);
/// Creates a pass that transforms perfectly nested loops with independent
/// bounds into a single loop.
-FunctionPassBase *createLoopCoalescingPass();
+std::unique_ptr<FunctionPassBase> createLoopCoalescingPass();
/// Performs packing (or explicit copying) of accessed memref regions into
/// buffers in the specified faster memory space through either pointwise copies
/// or DMA operations.
-FunctionPassBase *createAffineDataCopyGenerationPass(
+std::unique_ptr<FunctionPassBase> createAffineDataCopyGenerationPass(
unsigned slowMemorySpace, unsigned fastMemorySpace,
unsigned tagMemorySpace = 0, int minDmaTransferSize = 1024,
uint64_t fastMemCapacityBytes = std::numeric_limits<uint64_t>::max());
/// Creates a pass to lower VectorTransferReadOp and VectorTransferWriteOp.
-FunctionPassBase *createLowerVectorTransfersPass();
+std::unique_ptr<FunctionPassBase> createLowerVectorTransfersPass();
/// Creates a pass to perform optimizations relying on memref dataflow such as
/// store to load forwarding, elimination of dead stores, and dead allocs.
-FunctionPassBase *createMemRefDataFlowOptPass();
+std::unique_ptr<FunctionPassBase> createMemRefDataFlowOptPass();
/// Creates a pass to strip debug information from a function.
-FunctionPassBase *createStripDebugInfoPass();
+std::unique_ptr<FunctionPassBase> createStripDebugInfoPass();
/// Creates a pass which tests loop fusion utilities.
-FunctionPassBase *createTestLoopFusionPass();
+std::unique_ptr<FunctionPassBase> createTestLoopFusionPass();
} // end namespace mlir
diff --git a/mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp b/mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
index 7663775..0223dee9 100644
--- a/mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
+++ b/mlir/lib/Conversion/GPUToCUDA/ConvertKernelFuncToCubin.cpp
@@ -163,9 +163,9 @@ GpuKernelToCubinPass::translateGpuKernelToCubinAnnotation(FuncOp &function) {
return success();
}
-ModulePassBase *
+std::unique_ptr<ModulePassBase>
mlir::createConvertGPUKernelToCubinPass(CubinGenerator cubinGenerator) {
- return new GpuKernelToCubinPass(cubinGenerator);
+ return llvm::make_unique<GpuKernelToCubinPass>(cubinGenerator);
}
static PassRegistration<GpuKernelToCubinPass>
diff --git a/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp b/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp
index bf75778..bf0816c 100644
--- a/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp
+++ b/mlir/lib/Conversion/GPUToCUDA/ConvertLaunchFuncToCudaCalls.cpp
@@ -382,8 +382,9 @@ void GpuLaunchFuncToCudaCallsPass::translateGpuLaunchCalls(
launchOp.erase();
}
-mlir::ModulePassBase *mlir::createConvertGpuLaunchFuncToCudaCallsPass() {
- return new GpuLaunchFuncToCudaCallsPass();
+std::unique_ptr<mlir::ModulePassBase>
+mlir::createConvertGpuLaunchFuncToCudaCallsPass() {
+ return llvm::make_unique<GpuLaunchFuncToCudaCallsPass>();
}
static PassRegistration<GpuLaunchFuncToCudaCallsPass>
diff --git a/mlir/lib/Conversion/GPUToCUDA/GenerateCubinAccessors.cpp b/mlir/lib/Conversion/GPUToCUDA/GenerateCubinAccessors.cpp
index 813a3be..fa48163 100644
--- a/mlir/lib/Conversion/GPUToCUDA/GenerateCubinAccessors.cpp
+++ b/mlir/lib/Conversion/GPUToCUDA/GenerateCubinAccessors.cpp
@@ -141,8 +141,8 @@ private:
} // anonymous namespace
-ModulePassBase *createGenerateCubinAccessorPass() {
- return new GpuGenerateCubinAccessorsPass();
+std::unique_ptr<ModulePassBase> createGenerateCubinAccessorPass() {
+ return llvm::make_unique<GpuGenerateCubinAccessorsPass>();
}
static PassRegistration<GpuGenerateCubinAccessorsPass>
diff --git a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
index e4a6f96..9167148 100644
--- a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
+++ b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
@@ -128,8 +128,8 @@ public:
} // anonymous namespace
-FunctionPassBase *createLowerGpuOpsToNVVMOpsPass() {
- return new LowerGpuOpsToNVVMOpsPass();
+std::unique_ptr<FunctionPassBase> createLowerGpuOpsToNVVMOpsPass() {
+ return llvm::make_unique<LowerGpuOpsToNVVMOpsPass>();
}
static PassRegistration<LowerGpuOpsToNVVMOpsPass>
diff --git a/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp b/mlir/lib/Conversion/LoopsToGPU/LoopsToGPUPass.cpp
index 7c785b5..36869b8 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());
});
diff --git a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
index c62a5d8..731c07e 100644
--- a/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
+++ b/mlir/lib/Conversion/StandardToLLVM/ConvertStandardToLLVM.cpp
@@ -1132,14 +1132,15 @@ struct LLVMLoweringPass : public ModulePass<LLVMLoweringPass> {
};
} // end namespace
-ModulePassBase *mlir::createConvertToLLVMIRPass() {
- return new LLVMLoweringPass;
+std::unique_ptr<ModulePassBase> mlir::createConvertToLLVMIRPass() {
+ return llvm::make_unique<LLVMLoweringPass>();
}
-ModulePassBase *
+std::unique_ptr<ModulePassBase>
mlir::createConvertToLLVMIRPass(LLVMPatternListFiller patternListFiller,
LLVMTypeConverterMaker typeConverterMaker) {
- return new LLVMLoweringPass(patternListFiller, typeConverterMaker);
+ return llvm::make_unique<LLVMLoweringPass>(patternListFiller,
+ typeConverterMaker);
}
static PassRegistration<LLVMLoweringPass>
diff --git a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp
index ad2c4b5..3d4ef63 100644
--- a/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/StandardToSPIRV/ConvertStandardToSPIRVPass.cpp
@@ -48,8 +48,9 @@ void ConvertStandardToSPIRVPass::runOnModule() {
}
}
-ModulePassBase *mlir::spirv::createConvertStandardToSPIRVPass() {
- return new ConvertStandardToSPIRVPass();
+std::unique_ptr<ModulePassBase>
+mlir::spirv::createConvertStandardToSPIRVPass() {
+ return llvm::make_unique<ConvertStandardToSPIRVPass>();
}
static PassRegistration<ConvertStandardToSPIRVPass>
diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index 01decce..b7be427 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -109,8 +109,8 @@ public:
} // namespace
-ModulePassBase *mlir::createGpuKernelOutliningPass() {
- return new GpuKernelOutliningPass();
+std::unique_ptr<ModulePassBase> mlir::createGpuKernelOutliningPass() {
+ return llvm::make_unique<GpuKernelOutliningPass>();
}
static PassRegistration<GpuKernelOutliningPass>
diff --git a/mlir/lib/Dialect/QuantOps/Transforms/ConvertConst.cpp b/mlir/lib/Dialect/QuantOps/Transforms/ConvertConst.cpp
index 120d0cf..9c48c67 100644
--- a/mlir/lib/Dialect/QuantOps/Transforms/ConvertConst.cpp
+++ b/mlir/lib/Dialect/QuantOps/Transforms/ConvertConst.cpp
@@ -112,8 +112,8 @@ void ConvertConstPass::runOnFunction() {
applyPatternsGreedily(func, patterns);
}
-FunctionPassBase *mlir::quant::createConvertConstPass() {
- return new ConvertConstPass();
+std::unique_ptr<FunctionPassBase> mlir::quant::createConvertConstPass() {
+ return llvm::make_unique<ConvertConstPass>();
}
static PassRegistration<ConvertConstPass>
diff --git a/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp b/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp
index dfdce89..924e639 100644
--- a/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp
+++ b/mlir/lib/Dialect/QuantOps/Transforms/ConvertSimQuant.cpp
@@ -103,8 +103,9 @@ void ConvertSimulatedQuantPass::runOnFunction() {
signalPassFailure();
}
-FunctionPassBase *mlir::quant::createConvertSimulatedQuantPass() {
- return new ConvertSimulatedQuantPass();
+std::unique_ptr<FunctionPassBase>
+mlir::quant::createConvertSimulatedQuantPass() {
+ return llvm::make_unique<ConvertSimulatedQuantPass>();
}
static PassRegistration<ConvertSimulatedQuantPass>
diff --git a/mlir/lib/Linalg/Transforms/Fusion.cpp b/mlir/lib/Linalg/Transforms/Fusion.cpp
index 4864f39..992c466 100644
--- a/mlir/lib/Linalg/Transforms/Fusion.cpp
+++ b/mlir/lib/Linalg/Transforms/Fusion.cpp
@@ -350,14 +350,14 @@ LinalgFusionPass::LinalgFusionPass(ArrayRef<int64_t> sizes)
this->tileSizes.assign(sizes.begin(), sizes.end());
}
-FunctionPassBase *
+std::unique_ptr<FunctionPassBase>
mlir::linalg::createLinalgFusionPass(ArrayRef<int64_t> tileSizes) {
- return new LinalgFusionPass(tileSizes);
+ return llvm::make_unique<LinalgFusionPass>(tileSizes);
}
static PassRegistration<LinalgFusionPass>
pass("linalg-fusion", "Fuse operations in the linalg dialect", [] {
- auto *pass = new LinalgFusionPass();
+ auto pass = llvm::make_unique<LinalgFusionPass>();
pass->tileSizes.assign(clTileSizes.begin(), clTileSizes.end());
return pass;
});
diff --git a/mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp b/mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp
index 84452a2..49af61e 100644
--- a/mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp
+++ b/mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp
@@ -741,8 +741,8 @@ void LowerLinalgToLLVMPass::runOnModule() {
}
}
-ModulePassBase *mlir::linalg::createLowerLinalgToLLVMPass() {
- return new LowerLinalgToLLVMPass();
+std::unique_ptr<ModulePassBase> mlir::linalg::createLowerLinalgToLLVMPass() {
+ return llvm::make_unique<LowerLinalgToLLVMPass>();
}
static PassRegistration<LowerLinalgToLLVMPass>
diff --git a/mlir/lib/Linalg/Transforms/LowerToLoops.cpp b/mlir/lib/Linalg/Transforms/LowerToLoops.cpp
index afeb5c4..24e56b1 100644
--- a/mlir/lib/Linalg/Transforms/LowerToLoops.cpp
+++ b/mlir/lib/Linalg/Transforms/LowerToLoops.cpp
@@ -390,8 +390,8 @@ void LowerLinalgToLoopsPass::runOnFunction() {
}
}
-FunctionPassBase *mlir::linalg::createLowerLinalgToLoopsPass() {
- return new LowerLinalgToLoopsPass();
+std::unique_ptr<FunctionPassBase> mlir::linalg::createLowerLinalgToLoopsPass() {
+ return llvm::make_unique<LowerLinalgToLoopsPass>();
}
static PassRegistration<LowerLinalgToLoopsPass>
diff --git a/mlir/lib/Linalg/Transforms/Tiling.cpp b/mlir/lib/Linalg/Transforms/Tiling.cpp
index 8090a58..48c0da8 100644
--- a/mlir/lib/Linalg/Transforms/Tiling.cpp
+++ b/mlir/lib/Linalg/Transforms/Tiling.cpp
@@ -527,15 +527,15 @@ LinalgTilingPass::LinalgTilingPass(ArrayRef<int64_t> sizes, bool promoteViews) {
this->promoteViews = promoteViews;
}
-FunctionPassBase *
+std::unique_ptr<FunctionPassBase>
mlir::linalg::createLinalgTilingPass(ArrayRef<int64_t> tileSizes,
bool promoteViews) {
- return new LinalgTilingPass(tileSizes, promoteViews);
+ return llvm::make_unique<LinalgTilingPass>(tileSizes, promoteViews);
}
static PassRegistration<LinalgTilingPass>
pass("linalg-tile", "Tile operations in the linalg dialect", [] {
- auto *pass = new LinalgTilingPass();
+ auto pass = llvm::make_unique<LinalgTilingPass>();
pass->tileSizes.assign(clTileSizes.begin(), clTileSizes.end());
pass->promoteViews = clPromoteFullTileViews;
return pass;
diff --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp
index 3ed7b24..35d9663 100644
--- a/mlir/lib/Pass/Pass.cpp
+++ b/mlir/lib/Pass/Pass.cpp
@@ -264,44 +264,44 @@ void PassManager::disableMultithreading(bool disable) {
/// Add an opaque pass pointer to the current manager. This takes ownership
/// over the provided pass pointer.
-void PassManager::addPass(Pass *pass) {
+void PassManager::addPass(std::unique_ptr<Pass> pass) {
switch (pass->getKind()) {
case Pass::Kind::FunctionPass:
- addPass(cast<FunctionPassBase>(pass));
+ addPass(cast<FunctionPassBase>(std::move(pass)));
break;
case Pass::Kind::ModulePass:
- addPass(cast<ModulePassBase>(pass));
+ addPass(cast<ModulePassBase>(std::move(pass)));
break;
}
}
/// Add a module pass to the current manager. This takes ownership over the
/// provided pass pointer.
-void PassManager::addPass(ModulePassBase *pass) {
+void PassManager::addPass(std::unique_ptr<ModulePassBase> pass) {
nestedExecutorStack.clear();
- mpe->addPass(pass);
+ mpe->addPass(std::move(pass));
// Add a verifier run if requested.
if (verifyPasses)
- mpe->addPass(new ModuleVerifierPass());
+ mpe->addPass(llvm::make_unique<ModuleVerifierPass>());
}
/// Add a function pass to the current manager. This takes ownership over the
/// provided pass pointer. This will automatically create a function pass
/// executor if necessary.
-void PassManager::addPass(FunctionPassBase *pass) {
+void PassManager::addPass(std::unique_ptr<FunctionPassBase> pass) {
detail::FunctionPassExecutor *fpe;
if (nestedExecutorStack.empty()) {
/// Create an executor adaptor for this pass.
if (disableThreads || !llvm::llvm_is_multithreaded()) {
// If multi-threading is disabled, then create a synchronous adaptor.
- auto *adaptor = new ModuleToFunctionPassAdaptor();
- addPass(adaptor);
+ auto adaptor = llvm::make_unique<ModuleToFunctionPassAdaptor>();
fpe = &adaptor->getFunctionExecutor();
+ addPass(std::unique_ptr<ModulePassBase>{adaptor.release()});
} else {
- auto *adaptor = new ModuleToFunctionPassAdaptorParallel();
- addPass(adaptor);
+ auto adaptor = llvm::make_unique<ModuleToFunctionPassAdaptorParallel>();
fpe = &adaptor->getFunctionExecutor();
+ addPass(std::unique_ptr<ModulePassBase>{adaptor.release()});
}
/// Add the executor to the stack.
@@ -309,11 +309,11 @@ void PassManager::addPass(FunctionPassBase *pass) {
} else {
fpe = cast<detail::FunctionPassExecutor>(nestedExecutorStack.back());
}
- fpe->addPass(pass);
+ fpe->addPass(std::move(pass));
// Add a verifier run if requested.
if (verifyPasses)
- fpe->addPass(new FunctionVerifierPass());
+ fpe->addPass(llvm::make_unique<FunctionVerifierPass>());
}
/// Add the provided instrumentation to the pass manager. This takes ownership
diff --git a/mlir/lib/Pass/PassDetail.h b/mlir/lib/Pass/PassDetail.h
index 0b41c44..bb482a2 100644
--- a/mlir/lib/Pass/PassDetail.h
+++ b/mlir/lib/Pass/PassDetail.h
@@ -66,7 +66,9 @@ public:
/// Add a pass to the current executor. This takes ownership over the provided
/// pass pointer.
- void addPass(FunctionPassBase *pass) { passes.emplace_back(pass); }
+ void addPass(std::unique_ptr<FunctionPassBase> pass) {
+ passes.push_back(std::move(pass));
+ }
/// Returns the number of passes held by this executor.
size_t size() const { return passes.size(); }
@@ -94,7 +96,9 @@ public:
/// Add a pass to the current executor. This takes ownership over the provided
/// pass pointer.
- void addPass(ModulePassBase *pass) { passes.emplace_back(pass); }
+ void addPass(std::unique_ptr<ModulePassBase> pass) {
+ passes.push_back(std::move(pass));
+ }
static bool classof(const PassExecutor *pe) {
return pe->getKind() == Kind::ModuleExecutor;
diff --git a/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp b/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp
index 3f26bf0..4868d3b 100644
--- a/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp
+++ b/mlir/lib/Quantizer/Transforms/AddDefaultStatsTestPass.cpp
@@ -118,8 +118,8 @@ void AddDefaultStatsPass::runWithConfig(SolverContext &solverContext,
});
}
-FunctionPassBase *mlir::quantizer::createAddDefaultStatsPass() {
- return new AddDefaultStatsPass();
+std::unique_ptr<FunctionPassBase> mlir::quantizer::createAddDefaultStatsPass() {
+ return llvm::make_unique<AddDefaultStatsPass>();
}
static PassRegistration<AddDefaultStatsPass> pass(
diff --git a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp
index 765a36e..e1365e7 100644
--- a/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp
+++ b/mlir/lib/Quantizer/Transforms/InferQuantizedTypesPass.cpp
@@ -286,9 +286,9 @@ void InferQuantizedTypesPass::transformResultType(CAGResultAnchor *anchor,
}
}
-ModulePassBase *mlir::quantizer::createInferQuantizedTypesPass(
+std::unique_ptr<ModulePassBase> mlir::quantizer::createInferQuantizedTypesPass(
SolverContext &solverContext, const TargetConfiguration &config) {
- return new InferQuantizedTypesPass(solverContext, config);
+ return llvm::make_unique<InferQuantizedTypesPass>(solverContext, config);
}
static PassRegistration<InferQuantizedTypesPass>
diff --git a/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp b/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp
index d5fb284..104a3b6 100644
--- a/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp
+++ b/mlir/lib/Quantizer/Transforms/RemoveInstrumentationPass.cpp
@@ -66,8 +66,9 @@ void RemoveInstrumentationPass::runOnFunction() {
applyPatternsGreedily(func, patterns);
}
-FunctionPassBase *mlir::quantizer::createRemoveInstrumentationPass() {
- return new RemoveInstrumentationPass();
+std::unique_ptr<FunctionPassBase>
+mlir::quantizer::createRemoveInstrumentationPass() {
+ return llvm::make_unique<RemoveInstrumentationPass>();
}
static PassRegistration<RemoveInstrumentationPass>
diff --git a/mlir/lib/Transforms/AffineDataCopyGeneration.cpp b/mlir/lib/Transforms/AffineDataCopyGeneration.cpp
index 522ed4a..e422bd2 100644
--- a/mlir/lib/Transforms/AffineDataCopyGeneration.cpp
+++ b/mlir/lib/Transforms/AffineDataCopyGeneration.cpp
@@ -162,12 +162,12 @@ struct AffineDataCopyGeneration
/// buffers in 'fastMemorySpace', and replaces memory operations to the former
/// by the latter. Only load op's handled for now.
/// TODO(bondhugula): extend this to store op's.
-FunctionPassBase *mlir::createAffineDataCopyGenerationPass(
+std::unique_ptr<FunctionPassBase> mlir::createAffineDataCopyGenerationPass(
unsigned slowMemorySpace, unsigned fastMemorySpace, unsigned tagMemorySpace,
int minDmaTransferSize, uint64_t fastMemCapacityBytes) {
- return new AffineDataCopyGeneration(slowMemorySpace, fastMemorySpace,
- tagMemorySpace, minDmaTransferSize,
- fastMemCapacityBytes);
+ return llvm::make_unique<AffineDataCopyGeneration>(
+ slowMemorySpace, fastMemorySpace, tagMemorySpace, minDmaTransferSize,
+ fastMemCapacityBytes);
}
// Info comprising stride and number of elements transferred every stride.
diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp
index eeb63e7..5965852 100644
--- a/mlir/lib/Transforms/CSE.cpp
+++ b/mlir/lib/Transforms/CSE.cpp
@@ -258,7 +258,9 @@ void CSE::runOnFunction() {
markAnalysesPreserved<DominanceInfo, PostDominanceInfo>();
}
-FunctionPassBase *mlir::createCSEPass() { return new CSE(); }
+std::unique_ptr<FunctionPassBase> mlir::createCSEPass() {
+ return llvm::make_unique<CSE>();
+}
static PassRegistration<CSE>
pass("cse", "Eliminate common sub-expressions in functions");
diff --git a/mlir/lib/Transforms/Canonicalizer.cpp b/mlir/lib/Transforms/Canonicalizer.cpp
index 80d8ea9..6f4a40f 100644
--- a/mlir/lib/Transforms/Canonicalizer.cpp
+++ b/mlir/lib/Transforms/Canonicalizer.cpp
@@ -53,8 +53,8 @@ void Canonicalizer::runOnFunction() {
}
/// Create a Canonicalizer pass.
-FunctionPassBase *mlir::createCanonicalizerPass() {
- return new Canonicalizer();
+std::unique_ptr<FunctionPassBase> mlir::createCanonicalizerPass() {
+ return llvm::make_unique<Canonicalizer>();
}
static PassRegistration<Canonicalizer> pass("canonicalize",
diff --git a/mlir/lib/Transforms/LoopCoalescing.cpp b/mlir/lib/Transforms/LoopCoalescing.cpp
index f47433c..eb52e8d 100644
--- a/mlir/lib/Transforms/LoopCoalescing.cpp
+++ b/mlir/lib/Transforms/LoopCoalescing.cpp
@@ -96,8 +96,8 @@ public:
} // namespace
-FunctionPassBase *mlir::createLoopCoalescingPass() {
- return new LoopCoalescingPass;
+std::unique_ptr<FunctionPassBase> mlir::createLoopCoalescingPass() {
+ return llvm::make_unique<LoopCoalescingPass>();
}
static PassRegistration<LoopCoalescingPass>
diff --git a/mlir/lib/Transforms/LoopFusion.cpp b/mlir/lib/Transforms/LoopFusion.cpp
index ea1a03f0..2736ebc 100644
--- a/mlir/lib/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Transforms/LoopFusion.cpp
@@ -111,10 +111,11 @@ struct LoopFusion : public FunctionPass<LoopFusion> {
} // end anonymous namespace
-FunctionPassBase *mlir::createLoopFusionPass(unsigned fastMemorySpace,
- uint64_t localBufSizeThreshold,
- bool maximalFusion) {
- return new LoopFusion(fastMemorySpace, localBufSizeThreshold, maximalFusion);
+std::unique_ptr<FunctionPassBase>
+mlir::createLoopFusionPass(unsigned fastMemorySpace,
+ uint64_t localBufSizeThreshold, bool maximalFusion) {
+ return llvm::make_unique<LoopFusion>(fastMemorySpace, localBufSizeThreshold,
+ maximalFusion);
}
namespace {
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.
diff --git a/mlir/lib/Transforms/LoopTiling.cpp b/mlir/lib/Transforms/LoopTiling.cpp
index 0a331ca..d6ff9a94 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
diff --git a/mlir/lib/Transforms/LoopUnroll.cpp b/mlir/lib/Transforms/LoopUnroll.cpp
index 1c7f3393..c3db90e 100644
--- a/mlir/lib/Transforms/LoopUnroll.cpp
+++ b/mlir/lib/Transforms/LoopUnroll.cpp
@@ -180,10 +180,10 @@ LogicalResult LoopUnroll::runOnAffineForOp(AffineForOp forOp) {
return loopUnrollByFactor(forOp, kDefaultUnrollFactor);
}
-FunctionPassBase *mlir::createLoopUnrollPass(
+std::unique_ptr<FunctionPassBase> mlir::createLoopUnrollPass(
int unrollFactor, int unrollFull,
const std::function<unsigned(AffineForOp)> &getUnrollFactor) {
- return new LoopUnroll(
+ return llvm::make_unique<LoopUnroll>(
unrollFactor == -1 ? None : Optional<unsigned>(unrollFactor),
unrollFull == -1 ? None : Optional<bool>(unrollFull), getUnrollFactor);
}
diff --git a/mlir/lib/Transforms/LoopUnrollAndJam.cpp b/mlir/lib/Transforms/LoopUnrollAndJam.cpp
index 7650db1..362aa86 100644
--- a/mlir/lib/Transforms/LoopUnrollAndJam.cpp
+++ b/mlir/lib/Transforms/LoopUnrollAndJam.cpp
@@ -82,8 +82,9 @@ struct LoopUnrollAndJam : public FunctionPass<LoopUnrollAndJam> {
};
} // end anonymous namespace
-FunctionPassBase *mlir::createLoopUnrollAndJamPass(int unrollJamFactor) {
- return new LoopUnrollAndJam(
+std::unique_ptr<FunctionPassBase>
+mlir::createLoopUnrollAndJamPass(int unrollJamFactor) {
+ return llvm::make_unique<LoopUnrollAndJam>(
unrollJamFactor == -1 ? None : Optional<unsigned>(unrollJamFactor));
}
diff --git a/mlir/lib/Transforms/LowerAffine.cpp b/mlir/lib/Transforms/LowerAffine.cpp
index 062134d..f24bc6d 100644
--- a/mlir/lib/Transforms/LowerAffine.cpp
+++ b/mlir/lib/Transforms/LowerAffine.cpp
@@ -529,8 +529,8 @@ class LowerAffinePass : public FunctionPass<LowerAffinePass> {
/// Lowers If and For operations within a function into their lower level CFG
/// equivalent blocks.
-FunctionPassBase *mlir::createLowerAffinePass() {
- return new LowerAffinePass();
+std::unique_ptr<FunctionPassBase> mlir::createLowerAffinePass() {
+ return llvm::make_unique<LowerAffinePass>();
}
static PassRegistration<LowerAffinePass>
diff --git a/mlir/lib/Transforms/LowerVectorTransfers.cpp b/mlir/lib/Transforms/LowerVectorTransfers.cpp
index e2d5920..e941850b 100644
--- a/mlir/lib/Transforms/LowerVectorTransfers.cpp
+++ b/mlir/lib/Transforms/LowerVectorTransfers.cpp
@@ -373,8 +373,8 @@ struct LowerVectorTransfersPass
} // end anonymous namespace
-FunctionPassBase *mlir::createLowerVectorTransfersPass() {
- return new LowerVectorTransfersPass();
+std::unique_ptr<FunctionPassBase> mlir::createLowerVectorTransfersPass() {
+ return llvm::make_unique<LowerVectorTransfersPass>();
}
static PassRegistration<LowerVectorTransfersPass>
diff --git a/mlir/lib/Transforms/MaterializeVectors.cpp b/mlir/lib/Transforms/MaterializeVectors.cpp
index 17acc92..24b1f77 100644
--- a/mlir/lib/Transforms/MaterializeVectors.cpp
+++ b/mlir/lib/Transforms/MaterializeVectors.cpp
@@ -766,9 +766,9 @@ void MaterializeVectorsPass::runOnFunction() {
signalPassFailure();
}
-FunctionPassBase *
+std::unique_ptr<FunctionPassBase>
mlir::createMaterializeVectorsPass(llvm::ArrayRef<int64_t> vectorSize) {
- return new MaterializeVectorsPass(vectorSize);
+ return llvm::make_unique<MaterializeVectorsPass>(vectorSize);
}
static PassRegistration<MaterializeVectorsPass>
diff --git a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp
index 4f8b1c6..b16dff9 100644
--- a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp
+++ b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp
@@ -88,8 +88,8 @@ struct MemRefDataFlowOpt : public FunctionPass<MemRefDataFlowOpt> {
/// Creates a pass to perform optimizations relying on memref dataflow such as
/// store to load forwarding, elimination of dead stores, and dead allocs.
-FunctionPassBase *mlir::createMemRefDataFlowOptPass() {
- return new MemRefDataFlowOpt();
+std::unique_ptr<FunctionPassBase> mlir::createMemRefDataFlowOptPass() {
+ return llvm::make_unique<MemRefDataFlowOpt>();
}
// This is a straightforward implementation not optimized for speed. Optimize
diff --git a/mlir/lib/Transforms/PipelineDataTransfer.cpp b/mlir/lib/Transforms/PipelineDataTransfer.cpp
index af456c3..d4d91c9 100644
--- a/mlir/lib/Transforms/PipelineDataTransfer.cpp
+++ b/mlir/lib/Transforms/PipelineDataTransfer.cpp
@@ -49,8 +49,8 @@ struct PipelineDataTransfer : public FunctionPass<PipelineDataTransfer> {
/// Creates a pass to pipeline explicit movement of data across levels of the
/// memory hierarchy.
-FunctionPassBase *mlir::createPipelineDataTransferPass() {
- return new PipelineDataTransfer();
+std::unique_ptr<FunctionPassBase> mlir::createPipelineDataTransferPass() {
+ return llvm::make_unique<PipelineDataTransfer>();
}
// Returns the position of the tag memref operand given a DMA operation.
diff --git a/mlir/lib/Transforms/SimplifyAffineStructures.cpp b/mlir/lib/Transforms/SimplifyAffineStructures.cpp
index 3b6c231..3cc9309 100644
--- a/mlir/lib/Transforms/SimplifyAffineStructures.cpp
+++ b/mlir/lib/Transforms/SimplifyAffineStructures.cpp
@@ -88,8 +88,8 @@ struct SimplifyAffineStructures
} // end anonymous namespace
-FunctionPassBase *mlir::createSimplifyAffineStructuresPass() {
- return new SimplifyAffineStructures();
+std::unique_ptr<FunctionPassBase> mlir::createSimplifyAffineStructuresPass() {
+ return llvm::make_unique<SimplifyAffineStructures>();
}
void SimplifyAffineStructures::runOnFunction() {
diff --git a/mlir/lib/Transforms/StripDebugInfo.cpp b/mlir/lib/Transforms/StripDebugInfo.cpp
index c82354e..21d8ef1 100644
--- a/mlir/lib/Transforms/StripDebugInfo.cpp
+++ b/mlir/lib/Transforms/StripDebugInfo.cpp
@@ -38,8 +38,8 @@ void StripDebugInfo::runOnFunction() {
}
/// Creates a pass to strip debug information from a function.
-FunctionPassBase *mlir::createStripDebugInfoPass() {
- return new StripDebugInfo();
+std::unique_ptr<FunctionPassBase> mlir::createStripDebugInfoPass() {
+ return llvm::make_unique<StripDebugInfo>();
}
static PassRegistration<StripDebugInfo>
diff --git a/mlir/lib/Transforms/Vectorize.cpp b/mlir/lib/Transforms/Vectorize.cpp
index ce25406..932f00b 100644
--- a/mlir/lib/Transforms/Vectorize.cpp
+++ b/mlir/lib/Transforms/Vectorize.cpp
@@ -1276,9 +1276,9 @@ void Vectorize::runOnFunction() {
LLVM_DEBUG(dbgs() << "\n");
}
-FunctionPassBase *
+std::unique_ptr<FunctionPassBase>
mlir::createVectorizePass(llvm::ArrayRef<int64_t> virtualVectorSize) {
- return new Vectorize(virtualVectorSize);
+ return llvm::make_unique<Vectorize>(virtualVectorSize);
}
static PassRegistration<Vectorize>
diff --git a/mlir/test/lib/TestDialect/TestPatterns.cpp b/mlir/test/lib/TestDialect/TestPatterns.cpp
index 584ff99..9b7fe8e 100644
--- a/mlir/test/lib/TestDialect/TestPatterns.cpp
+++ b/mlir/test/lib/TestDialect/TestPatterns.cpp
@@ -247,6 +247,9 @@ static llvm::cl::opt<TestLegalizePatternDriver::ConversionMode>
clEnumValN(TestLegalizePatternDriver::ConversionMode::Partial,
"partial", "Perform a partial conversion")));
-static mlir::PassRegistration<TestLegalizePatternDriver> legalizer_pass(
- "test-legalize-patterns", "Run test dialect legalization patterns",
- [] { return new TestLegalizePatternDriver(legalizerConversionMode); });
+static mlir::PassRegistration<TestLegalizePatternDriver>
+ legalizer_pass("test-legalize-patterns",
+ "Run test dialect legalization patterns", [] {
+ return llvm::make_unique<TestLegalizePatternDriver>(
+ legalizerConversionMode);
+ });
diff --git a/mlir/test/lib/Transforms/TestConstantFold.cpp b/mlir/test/lib/Transforms/TestConstantFold.cpp
index 7d17f60..02c66ef 100644
--- a/mlir/test/lib/Transforms/TestConstantFold.cpp
+++ b/mlir/test/lib/Transforms/TestConstantFold.cpp
@@ -74,8 +74,8 @@ void TestConstantFold::runOnFunction() {
}
/// Creates a constant folding pass.
-FunctionPassBase *mlir::createTestConstantFoldPass() {
- return new TestConstantFold();
+std::unique_ptr<FunctionPassBase> mlir::createTestConstantFoldPass() {
+ return llvm::make_unique<TestConstantFold>();
}
static PassRegistration<TestConstantFold>
diff --git a/mlir/test/lib/Transforms/TestLoopFusion.cpp b/mlir/test/lib/Transforms/TestLoopFusion.cpp
index 3999096..bcb0507 100644
--- a/mlir/test/lib/Transforms/TestLoopFusion.cpp
+++ b/mlir/test/lib/Transforms/TestLoopFusion.cpp
@@ -58,8 +58,8 @@ struct TestLoopFusion : public FunctionPass<TestLoopFusion> {
} // end anonymous namespace
-FunctionPassBase *mlir::createTestLoopFusionPass() {
- return new TestLoopFusion;
+std::unique_ptr<FunctionPassBase> mlir::createTestLoopFusionPass() {
+ return llvm::make_unique<TestLoopFusion>();
}
// Gathers all AffineForOps in 'block' at 'currLoopDepth' in 'depthToLoops'.
diff --git a/mlir/test/lib/Transforms/TestLoopMapping.cpp b/mlir/test/lib/Transforms/TestLoopMapping.cpp
index bf35467..a9da70a 100644
--- a/mlir/test/lib/Transforms/TestLoopMapping.cpp
+++ b/mlir/test/lib/Transforms/TestLoopMapping.cpp
@@ -62,4 +62,4 @@ public:
static PassRegistration<TestLoopMappingPass>
reg("test-mapping-to-processing-elements",
"test mapping a single loop on a virtual processor grid",
- [] { return new TestLoopMappingPass(); });
+ [] { return llvm::make_unique<TestLoopMappingPass>(); });
diff --git a/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp b/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp
index d30eacc..e01ff66 100644
--- a/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp
+++ b/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp
@@ -55,9 +55,9 @@ public:
};
} // end namespace
-FunctionPassBase *
+std::unique_ptr<FunctionPassBase>
mlir::createSimpleParametricTilingPass(ArrayRef<int64_t> outerLoopSizes) {
- return new SimpleParametricLoopTilingPass(outerLoopSizes);
+ return llvm::make_unique<SimpleParametricLoopTilingPass>(outerLoopSizes);
}
static PassRegistration<SimpleParametricLoopTilingPass>
@@ -65,7 +65,8 @@ static PassRegistration<SimpleParametricLoopTilingPass>
"test application of parametric tiling to the outer loops so that the "
"ranges of outer loops become static",
[] {
- auto *pass = new SimpleParametricLoopTilingPass({});
+ auto pass = llvm::make_unique<SimpleParametricLoopTilingPass>(
+ ArrayRef<int64_t>{});
pass->sizes.assign(clOuterLoopSizes.begin(), clOuterLoopSizes.end());
return pass;
});
diff --git a/mlir/test/lib/Transforms/TestVectorizationUtils.cpp b/mlir/test/lib/Transforms/TestVectorizationUtils.cpp
index b51de41..3bfe6b6 100644
--- a/mlir/test/lib/Transforms/TestVectorizationUtils.cpp
+++ b/mlir/test/lib/Transforms/TestVectorizationUtils.cpp
@@ -290,8 +290,8 @@ void VectorizerTestPass::runOnFunction() {
}
}
-FunctionPassBase *mlir::createVectorizerTestPass() {
- return new VectorizerTestPass();
+std::unique_ptr<FunctionPassBase> mlir::createVectorizerTestPass() {
+ return llvm::make_unique<VectorizerTestPass>();
}
static PassRegistration<VectorizerTestPass>