[flang-commits] [flang] 067312d - [fir][NFC] Remove explicit num of inlined element for SmallVectors
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Fri Oct 1 05:41:55 PDT 2021
Author: Valentin Clement
Date: 2021-10-01T14:41:50+02:00
New Revision: 067312d28393e93ca15340b93278d3ba61fabd62
URL: https://github.com/llvm/llvm-project/commit/067312d28393e93ca15340b93278d3ba61fabd62
DIFF: https://github.com/llvm/llvm-project/commit/067312d28393e93ca15340b93278d3ba61fabd62.diff
LOG: [fir][NFC] Remove explicit num of inlined element for SmallVectors
Remove explicit number of inlined elements for SmallVector.
This patch is part of the upstreaming effort from fir-dev branch.
Co-authored-by: Jean Perier <jperier at nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz at nvidia.com>
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D110912
Added:
Modified:
flang/include/flang/Optimizer/Dialect/FIROps.td
flang/lib/Optimizer/Dialect/FIROps.cpp
Removed:
################################################################################
diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td
index 2e37db7317f0..d487bd17ec1f 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -529,7 +529,7 @@ class fir_IntegralSwitchTerminatorOp<string mnemonic,
CArg<"llvm::ArrayRef<mlir::NamedAttribute>", "{}">:$attributes),
[{
$_state.addOperands(selector);
- llvm::SmallVector<mlir::Attribute, 8> ivalues;
+ llvm::SmallVector<mlir::Attribute> ivalues;
for (auto iv : compareOperands)
ivalues.push_back($_builder.getI64IntegerAttr(iv));
ivalues.push_back($_builder.getUnitAttr());
@@ -538,7 +538,7 @@ class fir_IntegralSwitchTerminatorOp<string mnemonic,
for (auto d : destinations)
$_state.addSuccessors(d);
const auto opCount = destOperands.size();
- llvm::SmallVector<int32_t, 8> argOffs;
+ llvm::SmallVector<int32_t> argOffs;
int32_t sumArgs = 0;
for (std::remove_const_t<decltype(count)> i = 0; i != count; ++i) {
if (i < opCount) {
@@ -564,13 +564,13 @@ class fir_IntegralSwitchTerminatorOp<string mnemonic,
if (parseSelector(parser, result, selector, type))
return mlir::failure();
- llvm::SmallVector<mlir::Attribute, 8> ivalues;
- llvm::SmallVector<mlir::Block *, 8> dests;
- llvm::SmallVector<llvm::SmallVector<mlir::Value, 8>, 8> destArgs;
+ llvm::SmallVector<mlir::Attribute> ivalues;
+ llvm::SmallVector<mlir::Block *> dests;
+ llvm::SmallVector<llvm::SmallVector<mlir::Value>> destArgs;
while (true) {
mlir::Attribute ivalue; // Integer or Unit
mlir::Block *dest;
- llvm::SmallVector<mlir::Value, 8> destArg;
+ llvm::SmallVector<mlir::Value> destArg;
mlir::NamedAttrList temp;
if (parser.parseAttribute(ivalue, "i", temp) ||
parser.parseComma() ||
@@ -586,7 +586,7 @@ class fir_IntegralSwitchTerminatorOp<string mnemonic,
}
auto &bld = parser.getBuilder();
result.addAttribute(getCasesAttr(), bld.getArrayAttr(ivalues));
- llvm::SmallVector<int32_t, 8> argOffs;
+ llvm::SmallVector<int32_t> argOffs;
int32_t sumArgs = 0;
const auto count = dests.size();
for (std::remove_const_t<decltype(count)> i = 0; i != count; ++i) {
diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp
index bc4d685a525d..369f8e36ce9f 100644
--- a/flang/lib/Optimizer/Dialect/FIROps.cpp
+++ b/flang/lib/Optimizer/Dialect/FIROps.cpp
@@ -530,7 +530,7 @@ fir::BoxCharLenOp::fold(llvm::ArrayRef<mlir::Attribute> opnds) {
/// Get the result types packed in a tuple tuple
mlir::Type fir::BoxDimsOp::getTupleType() {
// note: triple, but 4 is nearest power of 2
- llvm::SmallVector<mlir::Type, 4> triple{
+ llvm::SmallVector<mlir::Type> triple{
getResult(0).getType(), getResult(1).getType(), getResult(2).getType()};
return mlir::TupleType::get(getContext(), triple);
}
@@ -555,14 +555,14 @@ static void printCallOp(mlir::OpAsmPrinter &p, fir::CallOp &op) {
p << '(' << op->getOperands().drop_front(isDirect ? 0 : 1) << ')';
p.printOptionalAttrDict(op->getAttrs(), {"callee"});
auto resultTypes{op.getResultTypes()};
- llvm::SmallVector<Type, 8> argTypes(
+ llvm::SmallVector<Type> argTypes(
llvm::drop_begin(op.getOperandTypes(), isDirect ? 0 : 1));
p << " : " << FunctionType::get(op.getContext(), argTypes, resultTypes);
}
static mlir::ParseResult parseCallOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- llvm::SmallVector<mlir::OpAsmParser::OperandType, 8> operands;
+ llvm::SmallVector<mlir::OpAsmParser::OperandType> operands;
if (parser.parseOperandList(operands))
return mlir::failure();
@@ -639,7 +639,7 @@ static void printCmpOp(OpAsmPrinter &p, OPTY op) {
template <typename OPTY>
static mlir::ParseResult parseCmpOp(mlir::OpAsmParser &parser,
mlir::OperationState &result) {
- llvm::SmallVector<mlir::OpAsmParser::OperandType, 2> ops;
+ llvm::SmallVector<mlir::OpAsmParser::OperandType> ops;
mlir::NamedAttrList attrs;
mlir::Attribute predicateNameAttr;
mlir::Type type;
@@ -831,10 +831,10 @@ static mlir::ParseResult parseCoordinateCustom(mlir::OpAsmParser &parser,
mlir::OpAsmParser::OperandType memref;
if (parser.parseOperand(memref) || parser.parseComma())
return mlir::failure();
- llvm::SmallVector<mlir::OpAsmParser::OperandType, 8> coorOperands;
+ llvm::SmallVector<mlir::OpAsmParser::OperandType> coorOperands;
if (parser.parseOperandList(coorOperands))
return mlir::failure();
- llvm::SmallVector<mlir::OpAsmParser::OperandType, 16> allOperands;
+ llvm::SmallVector<mlir::OpAsmParser::OperandType> allOperands;
allOperands.push_back(memref);
allOperands.append(coorOperands.begin(), coorOperands.end());
mlir::FunctionType funcTy;
@@ -1848,8 +1848,8 @@ static mlir::ParseResult parseDoLoopOp(mlir::OpAsmParser &parser,
result.addAttribute("unordered", builder.getUnitAttr());
// Parse the optional initial iteration arguments.
- llvm::SmallVector<mlir::OpAsmParser::OperandType, 4> regionArgs, operands;
- llvm::SmallVector<mlir::Type, 4> argTypes;
+ llvm::SmallVector<mlir::OpAsmParser::OperandType> regionArgs, operands;
+ llvm::SmallVector<mlir::Type> argTypes;
auto prependCount = false;
regionArgs.push_back(inductionVariable);
@@ -2318,16 +2318,16 @@ static mlir::ParseResult parseSelectCase(mlir::OpAsmParser &parser,
if (parseSelector(parser, result, selector, type))
return mlir::failure();
- llvm::SmallVector<mlir::Attribute, 8> attrs;
- llvm::SmallVector<mlir::OpAsmParser::OperandType, 8> opers;
- llvm::SmallVector<mlir::Block *, 8> dests;
- llvm::SmallVector<llvm::SmallVector<mlir::Value, 8>, 8> destArgs;
- llvm::SmallVector<int32_t, 8> argOffs;
+ llvm::SmallVector<mlir::Attribute> attrs;
+ llvm::SmallVector<mlir::OpAsmParser::OperandType> opers;
+ llvm::SmallVector<mlir::Block *> dests;
+ llvm::SmallVector<llvm::SmallVector<mlir::Value>> destArgs;
+ llvm::SmallVector<int32_t> argOffs;
int32_t offSize = 0;
while (true) {
mlir::Attribute attr;
mlir::Block *dest;
- llvm::SmallVector<mlir::Value, 8> destArg;
+ llvm::SmallVector<mlir::Value> destArg;
mlir::NamedAttrList temp;
if (parser.parseAttribute(attr, "a", temp) || isValidCaseAttr(attr) ||
parser.parseComma())
@@ -2366,7 +2366,7 @@ static mlir::ParseResult parseSelectCase(mlir::OpAsmParser &parser,
parser.getBuilder().getArrayAttr(attrs));
if (parser.resolveOperands(opers, type, result.operands))
return mlir::failure();
- llvm::SmallVector<int32_t, 8> targOffs;
+ llvm::SmallVector<int32_t> targOffs;
int32_t toffSize = 0;
const auto count = dests.size();
for (std::remove_const_t<decltype(count)> i = 0; i != count; ++i) {
@@ -2434,7 +2434,7 @@ void fir::SelectCaseOp::build(mlir::OpBuilder &builder,
llvm::ArrayRef<mlir::NamedAttribute> attributes) {
result.addOperands(selector);
result.addAttribute(getCasesAttr(), builder.getArrayAttr(compareAttrs));
- llvm::SmallVector<int32_t, 8> operOffs;
+ llvm::SmallVector<int32_t> operOffs;
int32_t operSize = 0;
for (auto attr : compareAttrs) {
if (attr.isa<fir::ClosedIntervalAttr>()) {
@@ -2455,7 +2455,7 @@ void fir::SelectCaseOp::build(mlir::OpBuilder &builder,
for (auto d : destinations)
result.addSuccessors(d);
const auto opCount = destOperands.size();
- llvm::SmallVector<int32_t, 8> argOffs;
+ llvm::SmallVector<int32_t> argOffs;
int32_t sumArgs = 0;
for (std::remove_const_t<decltype(count)> i = 0; i != count; ++i) {
if (i < opCount) {
@@ -2485,7 +2485,7 @@ void fir::SelectCaseOp::build(mlir::OpBuilder &builder,
llvm::ArrayRef<mlir::Block *> destinations,
llvm::ArrayRef<mlir::ValueRange> destOperands,
llvm::ArrayRef<mlir::NamedAttribute> attributes) {
- llvm::SmallVector<mlir::ValueRange, 16> cmpOpers;
+ llvm::SmallVector<mlir::ValueRange> cmpOpers;
auto iter = cmpOpList.begin();
for (auto &attr : compareAttrs) {
if (attr.isa<fir::ClosedIntervalAttr>()) {
@@ -2603,13 +2603,13 @@ static ParseResult parseSelectType(OpAsmParser &parser,
if (parseSelector(parser, result, selector, type))
return mlir::failure();
- llvm::SmallVector<mlir::Attribute, 8> attrs;
- llvm::SmallVector<mlir::Block *, 8> dests;
- llvm::SmallVector<llvm::SmallVector<mlir::Value, 8>, 8> destArgs;
+ llvm::SmallVector<mlir::Attribute> attrs;
+ llvm::SmallVector<mlir::Block *> dests;
+ llvm::SmallVector<llvm::SmallVector<mlir::Value>> destArgs;
while (true) {
mlir::Attribute attr;
mlir::Block *dest;
- llvm::SmallVector<mlir::Value, 8> destArg;
+ llvm::SmallVector<mlir::Value> destArg;
mlir::NamedAttrList temp;
if (parser.parseAttribute(attr, "a", temp) || parser.parseComma() ||
parser.parseSuccessorAndUseList(dest, destArg))
@@ -2625,7 +2625,7 @@ static ParseResult parseSelectType(OpAsmParser &parser,
auto &bld = parser.getBuilder();
result.addAttribute(fir::SelectTypeOp::getCasesAttr(),
bld.getArrayAttr(attrs));
- llvm::SmallVector<int32_t, 8> argOffs;
+ llvm::SmallVector<int32_t> argOffs;
int32_t offSize = 0;
const auto count = dests.size();
for (std::remove_const_t<decltype(count)> i = 0; i != count; ++i) {
More information about the flang-commits
mailing list