Change from llvm::make_unique to std::make_unique

Switch to C++14 standard method as llvm::make_unique has been removed (
https://reviews.llvm.org/D66259). Also mark some targets as c++14 to ease next
integrates.

PiperOrigin-RevId: 263953918
This commit is contained in:
Jacques Pienaar 2019-08-17 11:05:35 -07:00 committed by A. Unique TensorFlower
parent dbf8538b64
commit 79f53b0cf1
74 changed files with 195 additions and 205 deletions

View File

@ -301,5 +301,5 @@ Rewriter<linalg::StoreOp>::matchAndRewrite(linalg::StoreOp store,
} // namespace
std::unique_ptr<FunctionPassBase> linalg::createLowerLinalgLoadStorePass() {
return llvm::make_unique<LowerLinalgLoadStorePass>();
return std::make_unique<LowerLinalgLoadStorePass>();
}

View File

@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
return llvm::make_unique<ModuleAST>(std::move(functions));
return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
return llvm::make_unique<VariableExprAST>(std::move(loc), name);
return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
return llvm::make_unique<PrintExprAST>(std::move(loc),
std::move(Args[0]));
return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
return llvm::make_unique<CallExprAST>(std::move(loc), name,
std::move(Args));
return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
}
}
@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
auto type = llvm::make_unique<VarType>();
auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@ -341,11 +339,11 @@ private:
}
if (!type)
type = llvm::make_unique<VarType>();
type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
auto exprList = llvm::make_unique<ExprASTList>();
auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
return std::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}

View File

@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
return llvm::make_unique<ModuleAST>(std::move(functions));
return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
return llvm::make_unique<VariableExprAST>(std::move(loc), name);
return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
return llvm::make_unique<PrintExprAST>(std::move(loc),
std::move(Args[0]));
return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
return llvm::make_unique<CallExprAST>(std::move(loc), name,
std::move(Args));
return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
}
}
@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
auto type = llvm::make_unique<VarType>();
auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@ -341,11 +339,11 @@ private:
}
if (!type)
type = llvm::make_unique<VarType>();
type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
auto exprList = llvm::make_unique<ExprASTList>();
auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
return std::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}

View File

@ -43,11 +43,11 @@ using namespace toy;
using llvm::cast;
using llvm::dyn_cast;
using llvm::isa;
using llvm::make_unique;
using llvm::ScopedHashTableScope;
using llvm::SmallVector;
using llvm::StringRef;
using llvm::Twine;
using std::make_unique;
namespace {
@ -172,7 +172,7 @@ private:
// Create a builder for the function, it will be used throughout the codegen
// to create operations in this function.
builder = llvm::make_unique<mlir::OpBuilder>(function.getBody());
builder = std::make_unique<mlir::OpBuilder>(function.getBody());
// Emit the body of the function.
if (!mlirGen(*funcAST.getBody())) {

View File

@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
return llvm::make_unique<ModuleAST>(std::move(functions));
return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
return llvm::make_unique<VariableExprAST>(std::move(loc), name);
return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
return llvm::make_unique<PrintExprAST>(std::move(loc),
std::move(Args[0]));
return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
return llvm::make_unique<CallExprAST>(std::move(loc), name,
std::move(Args));
return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
}
}
@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
auto type = llvm::make_unique<VarType>();
auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@ -341,11 +339,11 @@ private:
}
if (!type)
type = llvm::make_unique<VarType>();
type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
auto exprList = llvm::make_unique<ExprASTList>();
auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
return std::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}

View File

@ -44,11 +44,11 @@ using namespace toy;
using llvm::cast;
using llvm::dyn_cast;
using llvm::isa;
using llvm::make_unique;
using llvm::ScopedHashTableScope;
using llvm::SmallVector;
using llvm::StringRef;
using llvm::Twine;
using std::make_unique;
namespace {
@ -173,7 +173,7 @@ private:
// Create a builder for the function, it will be used throughout the codegen
// to create operations in this function.
builder = llvm::make_unique<mlir::OpBuilder>(function.getBody());
builder = std::make_unique<mlir::OpBuilder>(function.getBody());
// Emit the body of the function.
if (!mlirGen(*funcAST.getBody())) {

View File

@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
return llvm::make_unique<ModuleAST>(std::move(functions));
return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
return llvm::make_unique<VariableExprAST>(std::move(loc), name);
return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
return llvm::make_unique<PrintExprAST>(std::move(loc),
std::move(Args[0]));
return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
return llvm::make_unique<CallExprAST>(std::move(loc), name,
std::move(Args));
return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
}
}
@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
auto type = llvm::make_unique<VarType>();
auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@ -341,11 +339,11 @@ private:
}
if (!type)
type = llvm::make_unique<VarType>();
type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
auto exprList = llvm::make_unique<ExprASTList>();
auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
return std::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}

View File

@ -44,11 +44,11 @@ using namespace toy;
using llvm::cast;
using llvm::dyn_cast;
using llvm::isa;
using llvm::make_unique;
using llvm::ScopedHashTableScope;
using llvm::SmallVector;
using llvm::StringRef;
using llvm::Twine;
using std::make_unique;
namespace {
@ -173,7 +173,7 @@ private:
// Create a builder for the function, it will be used throughout the codegen
// to create operations in this function.
builder = llvm::make_unique<mlir::OpBuilder>(function.getBody());
builder = std::make_unique<mlir::OpBuilder>(function.getBody());
// Emit the body of the function.
if (!mlirGen(*funcAST.getBody())) {

View File

@ -376,6 +376,6 @@ public:
namespace toy {
std::unique_ptr<mlir::Pass> createShapeInferencePass() {
return llvm::make_unique<ShapeInferencePass>();
return std::make_unique<ShapeInferencePass>();
}
} // namespace toy

View File

@ -62,7 +62,7 @@ public:
if (lexer.getCurToken() != tok_eof)
return parseError<ModuleAST>("nothing", "at end of module");
return llvm::make_unique<ModuleAST>(std::move(functions));
return std::make_unique<ModuleAST>(std::move(functions));
}
private:
@ -81,7 +81,7 @@ private:
if (!expr)
return nullptr;
}
return llvm::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
return std::make_unique<ReturnExprAST>(std::move(loc), std::move(expr));
}
/// Parse a literal number.
@ -89,7 +89,7 @@ private:
std::unique_ptr<ExprAST> ParseNumberExpr() {
auto loc = lexer.getLastLocation();
auto Result =
llvm::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
std::make_unique<NumberExprAST>(std::move(loc), lexer.getValue());
lexer.consume(tok_number);
return std::move(Result);
}
@ -157,8 +157,8 @@ private:
"inside literal expession");
}
}
return llvm::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
return std::make_unique<LiteralExprAST>(std::move(loc), std::move(values),
std::move(dims));
}
/// parenexpr ::= '(' expression ')'
@ -184,7 +184,7 @@ private:
lexer.getNextToken(); // eat identifier.
if (lexer.getCurToken() != '(') // Simple variable ref.
return llvm::make_unique<VariableExprAST>(std::move(loc), name);
return std::make_unique<VariableExprAST>(std::move(loc), name);
// This is a function call.
lexer.consume(Token('('));
@ -211,13 +211,11 @@ private:
if (Args.size() != 1)
return parseError<ExprAST>("<single arg>", "as argument to print()");
return llvm::make_unique<PrintExprAST>(std::move(loc),
std::move(Args[0]));
return std::make_unique<PrintExprAST>(std::move(loc), std::move(Args[0]));
}
// Call to a user-defined function
return llvm::make_unique<CallExprAST>(std::move(loc), name,
std::move(Args));
return std::make_unique<CallExprAST>(std::move(loc), name, std::move(Args));
}
/// primary
@ -281,8 +279,8 @@ private:
}
// Merge LHS/RHS.
LHS = llvm::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
LHS = std::make_unique<BinaryExprAST>(std::move(loc), BinOp,
std::move(LHS), std::move(RHS));
}
}
@ -302,7 +300,7 @@ private:
return parseError<VarType>("<", "to begin type");
lexer.getNextToken(); // eat <
auto type = llvm::make_unique<VarType>();
auto type = std::make_unique<VarType>();
while (lexer.getCurToken() == tok_number) {
type->shape.push_back(lexer.getValue());
@ -341,11 +339,11 @@ private:
}
if (!type)
type = llvm::make_unique<VarType>();
type = std::make_unique<VarType>();
lexer.consume(Token('='));
auto expr = ParseExpression();
return llvm::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
return std::make_unique<VarDeclExprAST>(std::move(loc), std::move(id),
std::move(*type), std::move(expr));
}
/// Parse a block: a list of expression separated by semicolons and wrapped in
@ -359,7 +357,7 @@ private:
return parseError<ExprASTList>("{", "to begin block");
lexer.consume(Token('{'));
auto exprList = llvm::make_unique<ExprASTList>();
auto exprList = std::make_unique<ExprASTList>();
// Ignore empty expressions: swallow sequences of semicolons.
while (lexer.getCurToken() == ';')
@ -422,7 +420,7 @@ private:
std::string name = lexer.getId();
auto loc = lexer.getLastLocation();
lexer.consume(tok_identifier);
auto decl = llvm::make_unique<VariableExprAST>(std::move(loc), name);
auto decl = std::make_unique<VariableExprAST>(std::move(loc), name);
args.push_back(std::move(decl));
if (lexer.getCurToken() != ',')
break;
@ -437,8 +435,8 @@ private:
// success.
lexer.consume(Token(')'));
return llvm::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
return std::make_unique<PrototypeAST>(std::move(loc), FnName,
std::move(args));
}
/// Parse a function definition, we expect a prototype initiated with the
@ -451,7 +449,7 @@ private:
return nullptr;
if (auto block = ParseBlock())
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return std::make_unique<FunctionAST>(std::move(Proto), std::move(block));
return nullptr;
}

View File

@ -143,6 +143,6 @@ struct EarlyLoweringPass : public FunctionPass<EarlyLoweringPass> {
namespace toy {
std::unique_ptr<mlir::Pass> createEarlyLoweringPass() {
return llvm::make_unique<EarlyLoweringPass>();
return std::make_unique<EarlyLoweringPass>();
}
} // namespace toy

View File

@ -455,6 +455,6 @@ struct LateLoweringPass : public ModulePass<LateLoweringPass> {
namespace toy {
std::unique_ptr<mlir::Pass> createLateLoweringPass() {
return llvm::make_unique<LateLoweringPass>();
return std::make_unique<LateLoweringPass>();
}
} // namespace toy

View File

@ -44,11 +44,11 @@ using namespace toy;
using llvm::cast;
using llvm::dyn_cast;
using llvm::isa;
using llvm::make_unique;
using llvm::ScopedHashTableScope;
using llvm::SmallVector;
using llvm::StringRef;
using llvm::Twine;
using std::make_unique;
namespace {
@ -173,7 +173,7 @@ private:
// Create a builder for the function, it will be used throughout the codegen
// to create operations in this function.
builder = llvm::make_unique<mlir::OpBuilder>(function.getBody());
builder = std::make_unique<mlir::OpBuilder>(function.getBody());
// Emit the body of the function.
if (!mlirGen(*funcAST.getBody())) {

View File

@ -376,6 +376,6 @@ public:
namespace toy {
std::unique_ptr<mlir::Pass> createShapeInferencePass() {
return llvm::make_unique<ShapeInferencePass>();
return std::make_unique<ShapeInferencePass>();
}
} // namespace toy

View File

@ -112,7 +112,7 @@ method:
/// supports, for use by the canonicalization pass.
static void getCanonicalizationPatterns(mlir::OwningRewritePatternList &results,
mlir::MLIRContext *context) {
results.push_back(llvm::make_unique<SimplifyRedundantTranspose>(context));
results.push_back(std::make_unique<SimplifyRedundantTranspose>(context));
}
```

View File

@ -74,7 +74,7 @@ template <typename TypeConverter = LLVMTypeConverter>
std::unique_ptr<ModulePassBase>
createConvertToLLVMIRPass(LLVMPatternListFiller patternListFiller) {
return createConvertToLLVMIRPass(patternListFiller, [](MLIRContext *context) {
return llvm::make_unique<TypeConverter>(context);
return std::make_unique<TypeConverter>(context);
});
}

View File

@ -262,7 +262,7 @@ protected:
addInterfaces<T2, Tys...>();
}
template <typename T> void addInterfaces() {
addInterface(llvm::make_unique<T>(this));
addInterface(std::make_unique<T>(this));
}
private:

View File

@ -422,7 +422,7 @@ public:
// FIXME: In c++17 this can be simplified by using 'fold expressions'.
using dummy = int[];
(void)dummy{
0, (patterns.emplace_back(llvm::make_unique<Ts>(arg, args...)), 0)...};
0, (patterns.emplace_back(std::make_unique<Ts>(arg, args...)), 0)...};
}
private:

View File

@ -123,7 +123,7 @@ public:
if (pi)
pi->runBeforeAnalysis(getAnalysisName<AnalysisT>(), id, ir);
it->second = llvm::make_unique<AnalysisModel<AnalysisT>>(ir);
it->second = std::make_unique<AnalysisModel<AnalysisT>>(ir);
if (pi)
pi->runAfterAnalysis(getAnalysisName<AnalysisT>(), id, ir);

View File

@ -260,7 +260,7 @@ struct FunctionPass : public detail::PassModel<FuncOp, T, FunctionPassBase> {
/// A clone method to create a copy of this pass.
std::unique_ptr<FunctionPassBase> clone() const override {
return llvm::make_unique<T>(*static_cast<const T *>(this));
return std::make_unique<T>(*static_cast<const T *>(this));
}
};

View File

@ -122,7 +122,7 @@ template <typename ConcretePass> struct PassRegistration {
PassRegistration(StringRef arg, StringRef description) {
PassAllocatorFunction constructor = [] {
return llvm::make_unique<ConcretePass>();
return std::make_unique<ConcretePass>();
};
registerPass(arg, description, PassID::getID<ConcretePass>(), constructor);
}

View File

@ -279,7 +279,7 @@ public:
Args... args) {
static_assert(std::is_convertible<T *, CAGConstraintNode *>(),
"T must be a CAGConstraingNode");
T *constraintNode = addNode(llvm::make_unique<T>(args...));
T *constraintNode = addNode(std::make_unique<T>(args...));
for (auto *anchor : anchors)
anchor->addOutgoing(constraintNode);
return constraintNode;
@ -292,7 +292,7 @@ public:
Args... args) {
static_assert(std::is_convertible<T *, CAGConstraintNode *>(),
"T must be a CAGConstraingNode");
T *constraintNode = addNode(llvm::make_unique<T>(args...));
T *constraintNode = addNode(std::make_unique<T>(args...));
fromAnchor->addOutgoing(constraintNode);
for (auto *toAnchor : toAnchors) {
constraintNode->addOutgoing(toAnchor);
@ -312,7 +312,7 @@ public:
T *constraintNode;
if (cluster.empty()) {
// Create new.
constraintNode = addNode(llvm::make_unique<T>());
constraintNode = addNode(std::make_unique<T>());
} else {
// Merge existing.
constraintNode = cluster[0];

View File

@ -303,7 +303,7 @@ FlatAffineConstraints::FlatAffineConstraints(
// Clones this object.
std::unique_ptr<FlatAffineConstraints> FlatAffineConstraints::clone() const {
return llvm::make_unique<FlatAffineConstraints>(*this);
return std::make_unique<FlatAffineConstraints>(*this);
}
// Construct from an IntegerSet.

View File

@ -45,7 +45,7 @@ void DominanceInfoBase<IsPostDom>::recalculate(Operation *op) {
// Don't compute dominance if the region is empty.
if (region.empty())
continue;
auto opDominance = llvm::make_unique<base>();
auto opDominance = std::make_unique<base>();
opDominance->recalculate(region);
dominanceInfos.try_emplace(&region, std::move(opDominance));
}

View File

@ -913,7 +913,7 @@ static Optional<int64_t> getMemoryFootprintBytes(Block &block,
}
// Compute the memref region symbolic in any IVs enclosing this block.
auto region = llvm::make_unique<MemRefRegion>(opInst->getLoc());
auto region = std::make_unique<MemRefRegion>(opInst->getLoc());
if (failed(
region->compute(opInst,
/*loopDepth=*/getNestingDepth(*block.begin())))) {

View File

@ -106,7 +106,7 @@ OwnedCubin
GpuKernelToCubinPass::compilePtxToCubinForTesting(const std::string &ptx,
FuncOp &function) {
const char data[] = "CUBIN";
return llvm::make_unique<std::vector<char>>(data, data + sizeof(data) - 1);
return std::make_unique<std::vector<char>>(data, data + sizeof(data) - 1);
}
OwnedCubin GpuKernelToCubinPass::convertModuleToCubin(llvm::Module &llvmModule,
@ -165,7 +165,7 @@ GpuKernelToCubinPass::translateGpuKernelToCubinAnnotation(FuncOp &function) {
std::unique_ptr<ModulePassBase>
mlir::createConvertGPUKernelToCubinPass(CubinGenerator cubinGenerator) {
return llvm::make_unique<GpuKernelToCubinPass>(cubinGenerator);
return std::make_unique<GpuKernelToCubinPass>(cubinGenerator);
}
static PassRegistration<GpuKernelToCubinPass>

View File

@ -384,7 +384,7 @@ void GpuLaunchFuncToCudaCallsPass::translateGpuLaunchCalls(
std::unique_ptr<mlir::ModulePassBase>
mlir::createConvertGpuLaunchFuncToCudaCallsPass() {
return llvm::make_unique<GpuLaunchFuncToCudaCallsPass>();
return std::make_unique<GpuLaunchFuncToCudaCallsPass>();
}
static PassRegistration<GpuLaunchFuncToCudaCallsPass>

View File

@ -120,7 +120,7 @@ private:
} // anonymous namespace
std::unique_ptr<ModulePassBase> createGenerateCubinAccessorPass() {
return llvm::make_unique<GpuGenerateCubinAccessorsPass>();
return std::make_unique<GpuGenerateCubinAccessorsPass>();
}
static PassRegistration<GpuGenerateCubinAccessorsPass>

View File

@ -129,7 +129,7 @@ public:
} // anonymous namespace
std::unique_ptr<FunctionPassBase> createLowerGpuOpsToNVVMOpsPass() {
return llvm::make_unique<LowerGpuOpsToNVVMOpsPass>();
return std::make_unique<LowerGpuOpsToNVVMOpsPass>();
}
static PassRegistration<LowerGpuOpsToNVVMOpsPass>

View File

@ -69,11 +69,11 @@ struct ForLoopMapper : public FunctionPass<ForLoopMapper> {
std::unique_ptr<FunctionPassBase>
mlir::createSimpleLoopsToGPUPass(unsigned numBlockDims,
unsigned numThreadDims) {
return llvm::make_unique<ForLoopMapper>(numBlockDims, numThreadDims);
return std::make_unique<ForLoopMapper>(numBlockDims, numThreadDims);
}
static PassRegistration<ForLoopMapper>
registration(PASS_NAME, "Convert top-level loops to GPU kernels", [] {
return llvm::make_unique<ForLoopMapper>(clNumBlockDims.getValue(),
clNumThreadDims.getValue());
return std::make_unique<ForLoopMapper>(clNumBlockDims.getValue(),
clNumThreadDims.getValue());
});

View File

@ -1082,7 +1082,7 @@ Type LLVMTypeConverter::packFunctionResults(ArrayRef<Type> types) {
/// Create an instance of LLVMTypeConverter in the given context.
static std::unique_ptr<LLVMTypeConverter>
makeStandardToLLVMTypeConverter(MLIRContext *context) {
return llvm::make_unique<LLVMTypeConverter>(context);
return std::make_unique<LLVMTypeConverter>(context);
}
namespace {
@ -1133,14 +1133,14 @@ struct LLVMLoweringPass : public ModulePass<LLVMLoweringPass> {
} // end namespace
std::unique_ptr<ModulePassBase> mlir::createConvertToLLVMIRPass() {
return llvm::make_unique<LLVMLoweringPass>();
return std::make_unique<LLVMLoweringPass>();
}
std::unique_ptr<ModulePassBase>
mlir::createConvertToLLVMIRPass(LLVMPatternListFiller patternListFiller,
LLVMTypeConverterMaker typeConverterMaker) {
return llvm::make_unique<LLVMLoweringPass>(patternListFiller,
typeConverterMaker);
return std::make_unique<LLVMLoweringPass>(patternListFiller,
typeConverterMaker);
}
static PassRegistration<LLVMLoweringPass>

View File

@ -50,7 +50,7 @@ void ConvertStandardToSPIRVPass::runOnModule() {
std::unique_ptr<ModulePassBase>
mlir::spirv::createConvertStandardToSPIRVPass() {
return llvm::make_unique<ConvertStandardToSPIRVPass>();
return std::make_unique<ConvertStandardToSPIRVPass>();
}
static PassRegistration<ConvertStandardToSPIRVPass>

View File

@ -110,7 +110,7 @@ public:
} // namespace
std::unique_ptr<ModulePassBase> mlir::createGpuKernelOutliningPass() {
return llvm::make_unique<GpuKernelOutliningPass>();
return std::make_unique<GpuKernelOutliningPass>();
}
static PassRegistration<GpuKernelOutliningPass>

View File

@ -113,7 +113,7 @@ void ConvertConstPass::runOnFunction() {
}
std::unique_ptr<FunctionPassBase> mlir::quant::createConvertConstPass() {
return llvm::make_unique<ConvertConstPass>();
return std::make_unique<ConvertConstPass>();
}
static PassRegistration<ConvertConstPass>

View File

@ -105,7 +105,7 @@ void ConvertSimulatedQuantPass::runOnFunction() {
std::unique_ptr<FunctionPassBase>
mlir::quant::createConvertSimulatedQuantPass() {
return llvm::make_unique<ConvertSimulatedQuantPass>();
return std::make_unique<ConvertSimulatedQuantPass>();
}
static PassRegistration<ConvertSimulatedQuantPass>

View File

@ -132,13 +132,13 @@ public:
: irTransformer(transform),
objectLayer(
session,
[this]() { return llvm::make_unique<MemoryManager>(session); }),
[this]() { return std::make_unique<MemoryManager>(session); }),
compileLayer(
session, objectLayer,
llvm::orc::ConcurrentIRCompiler(std::move(machineBuilder))),
transformLayer(session, compileLayer, makeIRTransformFunction()),
dataLayout(layout), mangler(session, this->dataLayout),
threadSafeCtx(llvm::make_unique<llvm::LLVMContext>()) {
threadSafeCtx(std::make_unique<llvm::LLVMContext>()) {
session.getMainJITDylib().addGenerator(
cantFail(llvm::orc::DynamicLibrarySearchGenerator::GetForCurrentProcess(
layout.getGlobalPrefix())));
@ -156,9 +156,9 @@ public:
if (!dataLayout)
return dataLayout.takeError();
return llvm::make_unique<OrcJIT>(std::move(*machineBuilder),
std::move(*dataLayout), transformer,
sharedLibPaths);
return std::make_unique<OrcJIT>(std::move(*machineBuilder),
std::move(*dataLayout), transformer,
sharedLibPaths);
}
// Add an LLVM module to the main library managed by the JIT engine.
@ -328,7 +328,7 @@ Expected<std::unique_ptr<ExecutionEngine>>
ExecutionEngine::create(ModuleOp m,
std::function<llvm::Error(llvm::Module *)> transformer,
ArrayRef<StringRef> sharedLibPaths) {
auto engine = llvm::make_unique<ExecutionEngine>();
auto engine = std::make_unique<ExecutionEngine>();
auto expectedJIT = impl::OrcJIT::createDefault(transformer, sharedLibPaths);
if (!expectedJIT)
return expectedJIT.takeError();

View File

@ -160,7 +160,7 @@ Diagnostic &Diagnostic::attachNote(llvm::Optional<Location> noteLoc) {
/// Append and return a new note.
notes.push_back(
llvm::make_unique<Diagnostic>(*noteLoc, DiagnosticSeverity::Note));
std::make_unique<Diagnostic>(*noteLoc, DiagnosticSeverity::Note));
return *notes.back();
}

View File

@ -352,12 +352,12 @@ LinalgFusionPass::LinalgFusionPass(ArrayRef<int64_t> sizes)
std::unique_ptr<FunctionPassBase>
mlir::linalg::createLinalgFusionPass(ArrayRef<int64_t> tileSizes) {
return llvm::make_unique<LinalgFusionPass>(tileSizes);
return std::make_unique<LinalgFusionPass>(tileSizes);
}
static PassRegistration<LinalgFusionPass>
pass("linalg-fusion", "Fuse operations in the linalg dialect", [] {
auto pass = llvm::make_unique<LinalgFusionPass>();
auto pass = std::make_unique<LinalgFusionPass>();
pass->tileSizes.assign(clTileSizes.begin(), clTileSizes.end());
return pass;
});

View File

@ -735,7 +735,7 @@ void LowerLinalgToLLVMPass::runOnModule() {
}
std::unique_ptr<ModulePassBase> mlir::linalg::createLowerLinalgToLLVMPass() {
return llvm::make_unique<LowerLinalgToLLVMPass>();
return std::make_unique<LowerLinalgToLLVMPass>();
}
static PassRegistration<LowerLinalgToLLVMPass>

View File

@ -391,7 +391,7 @@ void LowerLinalgToLoopsPass::runOnFunction() {
}
std::unique_ptr<FunctionPassBase> mlir::linalg::createLowerLinalgToLoopsPass() {
return llvm::make_unique<LowerLinalgToLoopsPass>();
return std::make_unique<LowerLinalgToLoopsPass>();
}
static PassRegistration<LowerLinalgToLoopsPass>

View File

@ -530,12 +530,12 @@ LinalgTilingPass::LinalgTilingPass(ArrayRef<int64_t> sizes, bool promoteViews) {
std::unique_ptr<FunctionPassBase>
mlir::linalg::createLinalgTilingPass(ArrayRef<int64_t> tileSizes,
bool promoteViews) {
return llvm::make_unique<LinalgTilingPass>(tileSizes, promoteViews);
return std::make_unique<LinalgTilingPass>(tileSizes, promoteViews);
}
static PassRegistration<LinalgTilingPass>
pass("linalg-tile", "Tile operations in the linalg dialect", [] {
auto pass = llvm::make_unique<LinalgTilingPass>();
auto pass = std::make_unique<LinalgTilingPass>();
pass->tileSizes.assign(clTileSizes.begin(), clTileSizes.end());
pass->promoteViews = clPromoteFullTileViews;
return pass;

View File

@ -283,7 +283,7 @@ void PassManager::addPass(std::unique_ptr<ModulePassBase> pass) {
// Add a verifier run if requested.
if (verifyPasses)
mpe->addPass(llvm::make_unique<ModuleVerifierPass>());
mpe->addPass(std::make_unique<ModuleVerifierPass>());
}
/// Add a function pass to the current manager. This takes ownership over the
@ -295,11 +295,11 @@ void PassManager::addPass(std::unique_ptr<FunctionPassBase> pass) {
/// 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 = llvm::make_unique<ModuleToFunctionPassAdaptor>();
auto adaptor = std::make_unique<ModuleToFunctionPassAdaptor>();
fpe = &adaptor->getFunctionExecutor();
addPass(std::unique_ptr<ModulePassBase>{adaptor.release()});
} else {
auto adaptor = llvm::make_unique<ModuleToFunctionPassAdaptorParallel>();
auto adaptor = std::make_unique<ModuleToFunctionPassAdaptorParallel>();
fpe = &adaptor->getFunctionExecutor();
addPass(std::unique_ptr<ModulePassBase>{adaptor.release()});
}
@ -313,7 +313,7 @@ void PassManager::addPass(std::unique_ptr<FunctionPassBase> pass) {
// Add a verifier run if requested.
if (verifyPasses)
fpe->addPass(llvm::make_unique<FunctionVerifierPass>());
fpe->addPass(std::make_unique<FunctionVerifierPass>());
}
/// Add the provided instrumentation to the pass manager. This takes ownership

View File

@ -283,5 +283,5 @@ struct FxpMathTargetConfigImpl : public FxpMathTargetConfig {
std::unique_ptr<FxpMathTargetConfig>
FxpMathTargetConfig::create(SolverContext &context) {
return llvm::make_unique<FxpMathTargetConfigImpl>(context);
return std::make_unique<FxpMathTargetConfigImpl>(context);
}

View File

@ -68,7 +68,7 @@ CAGOperandAnchor *CAGSlice::getOperandAnchor(Operation *op,
}
// Create.
auto anchor = llvm::make_unique<CAGOperandAnchor>(op, operandIdx);
auto anchor = std::make_unique<CAGOperandAnchor>(op, operandIdx);
auto *unowned = anchor.release();
unowned->nodeId = allNodes.size();
allNodes.push_back(unowned);
@ -87,7 +87,7 @@ CAGResultAnchor *CAGSlice::getResultAnchor(Operation *op, unsigned resultIdx) {
}
// Create.
auto anchor = llvm::make_unique<CAGResultAnchor>(op, resultIdx);
auto anchor = std::make_unique<CAGResultAnchor>(op, resultIdx);
auto *unowned = anchor.release();
unowned->nodeId = allNodes.size();
allNodes.push_back(unowned);

View File

@ -119,7 +119,7 @@ void AddDefaultStatsPass::runWithConfig(SolverContext &solverContext,
}
std::unique_ptr<FunctionPassBase> mlir::quantizer::createAddDefaultStatsPass() {
return llvm::make_unique<AddDefaultStatsPass>();
return std::make_unique<AddDefaultStatsPass>();
}
static PassRegistration<AddDefaultStatsPass> pass(

View File

@ -288,7 +288,7 @@ void InferQuantizedTypesPass::transformResultType(CAGResultAnchor *anchor,
std::unique_ptr<ModulePassBase> mlir::quantizer::createInferQuantizedTypesPass(
SolverContext &solverContext, const TargetConfiguration &config) {
return llvm::make_unique<InferQuantizedTypesPass>(solverContext, config);
return std::make_unique<InferQuantizedTypesPass>(solverContext, config);
}
static PassRegistration<InferQuantizedTypesPass>

View File

@ -68,7 +68,7 @@ void RemoveInstrumentationPass::runOnFunction() {
std::unique_ptr<FunctionPassBase>
mlir::quantizer::createRemoveInstrumentationPass() {
return llvm::make_unique<RemoveInstrumentationPass>();
return std::make_unique<RemoveInstrumentationPass>();
}
static PassRegistration<RemoveInstrumentationPass>

View File

@ -43,8 +43,8 @@ mlir::openInputFile(StringRef inputFilename, std::string *errorMessage) {
std::unique_ptr<llvm::ToolOutputFile>
mlir::openOutputFile(StringRef outputFilename, std::string *errorMessage) {
std::error_code error;
auto result = llvm::make_unique<llvm::ToolOutputFile>(outputFilename, error,
llvm::sys::fs::F_None);
auto result = std::make_unique<llvm::ToolOutputFile>(outputFilename, error,
llvm::sys::fs::F_None);
if (error) {
if (errorMessage)
*errorMessage = "cannot open output file '" + outputFilename.str() +

View File

@ -122,7 +122,7 @@ Operator &tblgen::DagNode::getDialectOp(RecordOperatorMap *mapper) const {
auto it = mapper->find(opDef);
if (it != mapper->end())
return *it->second;
return *mapper->try_emplace(opDef, llvm::make_unique<Operator>(opDef))
return *mapper->try_emplace(opDef, std::make_unique<Operator>(opDef))
.first->second;
}

View File

@ -165,7 +165,7 @@ struct AffineDataCopyGeneration
std::unique_ptr<FunctionPassBase> mlir::createAffineDataCopyGenerationPass(
unsigned slowMemorySpace, unsigned fastMemorySpace, unsigned tagMemorySpace,
int minDmaTransferSize, uint64_t fastMemCapacityBytes) {
return llvm::make_unique<AffineDataCopyGeneration>(
return std::make_unique<AffineDataCopyGeneration>(
slowMemorySpace, fastMemorySpace, tagMemorySpace, minDmaTransferSize,
fastMemCapacityBytes);
}
@ -743,7 +743,7 @@ uint64_t AffineDataCopyGeneration::runOnBlock(Block::iterator begin,
}
// Compute the MemRefRegion accessed.
auto region = llvm::make_unique<MemRefRegion>(opInst->getLoc());
auto region = std::make_unique<MemRefRegion>(opInst->getLoc());
if (failed(region->compute(opInst, copyDepth))) {
LLVM_DEBUG(llvm::dbgs()
<< "Error obtaining memory region: semi-affine maps?\n");

View File

@ -213,7 +213,7 @@ void CSE::simplifyRegion(ScopedMapTy &knownValues, DominanceInfo &domInfo,
std::deque<std::unique_ptr<CFGStackNode>> stack;
// Process the nodes of the dom tree for this region.
stack.emplace_back(llvm::make_unique<CFGStackNode>(
stack.emplace_back(std::make_unique<CFGStackNode>(
knownValues, domInfo.getRootNode(&region)));
while (!stack.empty()) {
@ -229,7 +229,7 @@ void CSE::simplifyRegion(ScopedMapTy &knownValues, DominanceInfo &domInfo,
if (currentNode->childIterator != currentNode->node->end()) {
auto *childNode = *(currentNode->childIterator++);
stack.emplace_back(
llvm::make_unique<CFGStackNode>(knownValues, childNode));
std::make_unique<CFGStackNode>(knownValues, childNode));
} else {
// Finally, if the node and all of its children have been processed
// then we delete the node.
@ -259,7 +259,7 @@ void CSE::runOnFunction() {
}
std::unique_ptr<FunctionPassBase> mlir::createCSEPass() {
return llvm::make_unique<CSE>();
return std::make_unique<CSE>();
}
static PassRegistration<CSE>

View File

@ -54,7 +54,7 @@ void Canonicalizer::runOnFunction() {
/// Create a Canonicalizer pass.
std::unique_ptr<FunctionPassBase> mlir::createCanonicalizerPass() {
return llvm::make_unique<Canonicalizer>();
return std::make_unique<Canonicalizer>();
}
static PassRegistration<Canonicalizer> pass("canonicalize",

View File

@ -97,7 +97,7 @@ public:
} // namespace
std::unique_ptr<FunctionPassBase> mlir::createLoopCoalescingPass() {
return llvm::make_unique<LoopCoalescingPass>();
return std::make_unique<LoopCoalescingPass>();
}
static PassRegistration<LoopCoalescingPass>

View File

@ -114,8 +114,8 @@ struct LoopFusion : public FunctionPass<LoopFusion> {
std::unique_ptr<FunctionPassBase>
mlir::createLoopFusionPass(unsigned fastMemorySpace,
uint64_t localBufSizeThreshold, bool maximalFusion) {
return llvm::make_unique<LoopFusion>(fastMemorySpace, localBufSizeThreshold,
maximalFusion);
return std::make_unique<LoopFusion>(fastMemorySpace, localBufSizeThreshold,
maximalFusion);
}
namespace {

View File

@ -77,7 +77,7 @@ static bool isMemRefDereferencingOp(Operation &op) {
}
std::unique_ptr<FunctionPassBase> mlir::createLoopInvariantCodeMotionPass() {
return llvm::make_unique<LoopInvariantCodeMotion>();
return std::make_unique<LoopInvariantCodeMotion>();
}
// Returns true if the individual op is loop invariant.

View File

@ -83,7 +83,7 @@ struct LoopTiling : public FunctionPass<LoopTiling> {
/// Function.
std::unique_ptr<FunctionPassBase>
mlir::createLoopTilingPass(uint64_t cacheSizeBytes) {
return llvm::make_unique<LoopTiling>(cacheSizeBytes);
return std::make_unique<LoopTiling>(cacheSizeBytes);
}
// Move the loop body of AffineForOp 'src' from 'src' into the specified

View File

@ -183,7 +183,7 @@ LogicalResult LoopUnroll::runOnAffineForOp(AffineForOp forOp) {
std::unique_ptr<FunctionPassBase> mlir::createLoopUnrollPass(
int unrollFactor, int unrollFull,
const std::function<unsigned(AffineForOp)> &getUnrollFactor) {
return llvm::make_unique<LoopUnroll>(
return std::make_unique<LoopUnroll>(
unrollFactor == -1 ? None : Optional<unsigned>(unrollFactor),
unrollFull == -1 ? None : Optional<bool>(unrollFull), getUnrollFactor);
}

View File

@ -84,7 +84,7 @@ struct LoopUnrollAndJam : public FunctionPass<LoopUnrollAndJam> {
std::unique_ptr<FunctionPassBase>
mlir::createLoopUnrollAndJamPass(int unrollJamFactor) {
return llvm::make_unique<LoopUnrollAndJam>(
return std::make_unique<LoopUnrollAndJam>(
unrollJamFactor == -1 ? None : Optional<unsigned>(unrollJamFactor));
}

View File

@ -530,7 +530,7 @@ class LowerAffinePass : public FunctionPass<LowerAffinePass> {
/// Lowers If and For operations within a function into their lower level CFG
/// equivalent blocks.
std::unique_ptr<FunctionPassBase> mlir::createLowerAffinePass() {
return llvm::make_unique<LowerAffinePass>();
return std::make_unique<LowerAffinePass>();
}
static PassRegistration<LowerAffinePass>

View File

@ -374,7 +374,7 @@ struct LowerVectorTransfersPass
} // end anonymous namespace
std::unique_ptr<FunctionPassBase> mlir::createLowerVectorTransfersPass() {
return llvm::make_unique<LowerVectorTransfersPass>();
return std::make_unique<LowerVectorTransfersPass>();
}
static PassRegistration<LowerVectorTransfersPass>

View File

@ -768,7 +768,7 @@ void MaterializeVectorsPass::runOnFunction() {
std::unique_ptr<FunctionPassBase>
mlir::createMaterializeVectorsPass(llvm::ArrayRef<int64_t> vectorSize) {
return llvm::make_unique<MaterializeVectorsPass>(vectorSize);
return std::make_unique<MaterializeVectorsPass>(vectorSize);
}
static PassRegistration<MaterializeVectorsPass>

View File

@ -89,7 +89,7 @@ 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.
std::unique_ptr<FunctionPassBase> mlir::createMemRefDataFlowOptPass() {
return llvm::make_unique<MemRefDataFlowOpt>();
return std::make_unique<MemRefDataFlowOpt>();
}
// This is a straightforward implementation not optimized for speed. Optimize

View File

@ -50,7 +50,7 @@ struct PipelineDataTransfer : public FunctionPass<PipelineDataTransfer> {
/// Creates a pass to pipeline explicit movement of data across levels of the
/// memory hierarchy.
std::unique_ptr<FunctionPassBase> mlir::createPipelineDataTransferPass() {
return llvm::make_unique<PipelineDataTransfer>();
return std::make_unique<PipelineDataTransfer>();
}
// Returns the position of the tag memref operand given a DMA operation.

View File

@ -89,7 +89,7 @@ struct SimplifyAffineStructures
} // end anonymous namespace
std::unique_ptr<FunctionPassBase> mlir::createSimplifyAffineStructuresPass() {
return llvm::make_unique<SimplifyAffineStructures>();
return std::make_unique<SimplifyAffineStructures>();
}
void SimplifyAffineStructures::runOnFunction() {

View File

@ -39,7 +39,7 @@ void StripDebugInfo::runOnFunction() {
/// Creates a pass to strip debug information from a function.
std::unique_ptr<FunctionPassBase> mlir::createStripDebugInfoPass() {
return llvm::make_unique<StripDebugInfo>();
return std::make_unique<StripDebugInfo>();
}
static PassRegistration<StripDebugInfo>

View File

@ -82,11 +82,11 @@ bool mlir::replaceAllMemRefUsesWith(Value *oldMemRef, Value *newMemRef,
std::unique_ptr<DominanceInfo> domInfo;
std::unique_ptr<PostDominanceInfo> postDomInfo;
if (domInstFilter)
domInfo = llvm::make_unique<DominanceInfo>(
domInfo = std::make_unique<DominanceInfo>(
domInstFilter->getParentOfType<FuncOp>());
if (postDomInstFilter)
postDomInfo = llvm::make_unique<PostDominanceInfo>(
postDomInfo = std::make_unique<PostDominanceInfo>(
postDomInstFilter->getParentOfType<FuncOp>());
// The ops where memref replacement succeeds are replaced with new ones.

View File

@ -1278,7 +1278,7 @@ void Vectorize::runOnFunction() {
std::unique_ptr<FunctionPassBase>
mlir::createVectorizePass(llvm::ArrayRef<int64_t> virtualVectorSize) {
return llvm::make_unique<Vectorize>(virtualVectorSize);
return std::make_unique<Vectorize>(virtualVectorSize);
}
static PassRegistration<Vectorize>

View File

@ -250,6 +250,6 @@ static llvm::cl::opt<TestLegalizePatternDriver::ConversionMode>
static mlir::PassRegistration<TestLegalizePatternDriver>
legalizer_pass("test-legalize-patterns",
"Run test dialect legalization patterns", [] {
return llvm::make_unique<TestLegalizePatternDriver>(
return std::make_unique<TestLegalizePatternDriver>(
legalizerConversionMode);
});

View File

@ -75,7 +75,7 @@ void TestConstantFold::runOnFunction() {
/// Creates a constant folding pass.
std::unique_ptr<FunctionPassBase> mlir::createTestConstantFoldPass() {
return llvm::make_unique<TestConstantFold>();
return std::make_unique<TestConstantFold>();
}
static PassRegistration<TestConstantFold>

View File

@ -59,7 +59,7 @@ struct TestLoopFusion : public FunctionPass<TestLoopFusion> {
} // end anonymous namespace
std::unique_ptr<FunctionPassBase> mlir::createTestLoopFusionPass() {
return llvm::make_unique<TestLoopFusion>();
return std::make_unique<TestLoopFusion>();
}
// Gathers all AffineForOps in 'block' at 'currLoopDepth' in 'depthToLoops'.

View File

@ -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 llvm::make_unique<TestLoopMappingPass>(); });
[] { return std::make_unique<TestLoopMappingPass>(); });

View File

@ -57,7 +57,7 @@ public:
std::unique_ptr<FunctionPassBase>
mlir::createSimpleParametricTilingPass(ArrayRef<int64_t> outerLoopSizes) {
return llvm::make_unique<SimpleParametricLoopTilingPass>(outerLoopSizes);
return std::make_unique<SimpleParametricLoopTilingPass>(outerLoopSizes);
}
static PassRegistration<SimpleParametricLoopTilingPass>
@ -65,7 +65,7 @@ static PassRegistration<SimpleParametricLoopTilingPass>
"test application of parametric tiling to the outer loops so that the "
"ranges of outer loops become static",
[] {
auto pass = llvm::make_unique<SimpleParametricLoopTilingPass>(
auto pass = std::make_unique<SimpleParametricLoopTilingPass>(
ArrayRef<int64_t>{});
pass->sizes.assign(clOuterLoopSizes.begin(), clOuterLoopSizes.end());
return pass;

View File

@ -291,7 +291,7 @@ void VectorizerTestPass::runOnFunction() {
}
std::unique_ptr<FunctionPassBase> mlir::createVectorizerTestPass() {
return llvm::make_unique<VectorizerTestPass>();
return std::make_unique<VectorizerTestPass>();
}
static PassRegistration<VectorizerTestPass>

View File

@ -98,8 +98,8 @@ OwnedCubin compilePtxToCubin(const std::string ptx, FuncOp &function) {
"cuLinkComplete");
char *cubinAsChar = static_cast<char *>(cubinData);
OwnedCubin result = llvm::make_unique<std::vector<char>>(
cubinAsChar, cubinAsChar + cubinSize);
OwnedCubin result =
std::make_unique<std::vector<char>>(cubinAsChar, cubinAsChar + cubinSize);
// This will also destroy the cubin data.
RETURN_ON_CUDA_ERROR(cuLinkDestroy(linkState), "cuLinkDestroy");