Skip to content

Commit 6f8ef5a

Browse files
[flang] Construct SmallVector with ArrayRef (NFC) (#101901)
1 parent 6676f79 commit 6f8ef5a

File tree

8 files changed

+13
-19
lines changed

8 files changed

+13
-19
lines changed

flang/include/flang/Lower/CallInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class CallInterface {
138138
FirPlaceHolder(mlir::Type t, int passedPosition, Property p,
139139
llvm::ArrayRef<mlir::NamedAttribute> attrs)
140140
: type{t}, passedEntityPosition{passedPosition}, property{p},
141-
attributes{attrs.begin(), attrs.end()} {}
141+
attributes{attrs} {}
142142
/// Type for this input/output
143143
mlir::Type type;
144144
/// Position of related passedEntity in passedArguments.

flang/include/flang/Lower/IterationSpace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class IterationSpace {
5656
explicit IterationSpace(const IterationSpace &from,
5757
llvm::ArrayRef<mlir::Value> idxs)
5858
: inArg(from.inArg), outRes(from.outRes), element(from.element),
59-
indices(idxs.begin(), idxs.end()) {}
59+
indices(idxs) {}
6060

6161
/// Create a copy of the \p from IterationSpace and prepend the \p prefix
6262
/// values and append the \p suffix values, respectively.

flang/include/flang/Optimizer/Builder/BoxValue.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ class AbstractArrayBox {
127127
AbstractArrayBox() = default;
128128
AbstractArrayBox(llvm::ArrayRef<mlir::Value> extents,
129129
llvm::ArrayRef<mlir::Value> lbounds)
130-
: extents{extents.begin(), extents.end()}, lbounds{lbounds.begin(),
131-
lbounds.end()} {}
130+
: extents{extents}, lbounds{lbounds} {}
132131

133132
// Every array has extents that describe its shape.
134133
const llvm::SmallVectorImpl<mlir::Value> &getExtents() const {
@@ -296,7 +295,7 @@ class BoxValue : public AbstractIrBox {
296295
llvm::ArrayRef<mlir::Value> explicitParams,
297296
llvm::ArrayRef<mlir::Value> explicitExtents = {})
298297
: AbstractIrBox{addr, lbounds, explicitExtents},
299-
explicitParams{explicitParams.begin(), explicitParams.end()} {
298+
explicitParams{explicitParams} {
300299
assert(verify());
301300
}
302301
// TODO: check contiguous attribute of addr

flang/include/flang/Optimizer/Support/InternalNames.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ struct NameUniquer {
5656
DeconstructedName(llvm::ArrayRef<std::string> modules,
5757
llvm::ArrayRef<std::string> procs, std::int64_t blockId,
5858
llvm::StringRef name, llvm::ArrayRef<std::int64_t> kinds)
59-
: modules{modules.begin(), modules.end()}, procs{procs.begin(),
60-
procs.end()},
61-
blockId{blockId}, name{name}, kinds{kinds.begin(), kinds.end()} {}
59+
: modules{modules}, procs{procs}, blockId{blockId}, name{name},
60+
kinds{kinds} {}
6261

6362
llvm::SmallVector<std::string> modules;
6463
llvm::SmallVector<std::string> procs;

flang/lib/Lower/ConvertArrayConstructor.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ class AsElementalStrategy : public StrategyBase {
194194
fir::SequenceType declaredType, mlir::Value extent,
195195
llvm::ArrayRef<mlir::Value> lengths)
196196
: StrategyBase{stmtCtx, symMap}, shape{builder.genShape(loc, {extent})},
197-
lengthParams{lengths.begin(), lengths.end()},
198-
exprType{getExprType(declaredType)} {}
197+
lengthParams{lengths}, exprType{getExprType(declaredType)} {}
199198

200199
static hlfir::ExprType getExprType(fir::SequenceType declaredType) {
201200
// Note: 7.8 point 4: the dynamic type of an array constructor is its static
@@ -331,8 +330,7 @@ class RuntimeTempStrategy : public StrategyBase {
331330
// Prepare the initial state of the allocatable descriptor with a
332331
// deallocated status and all the available knowledge about the extent
333332
// and length parameters.
334-
llvm::SmallVector<mlir::Value> emboxLengths(lengths.begin(),
335-
lengths.end());
333+
llvm::SmallVector<mlir::Value> emboxLengths(lengths);
336334
if (!extent)
337335
extent = builder.createIntegerConstant(loc, builder.getIndexType(), 0);
338336
if (missingLengthParameters) {

flang/lib/Lower/IterationSpace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class ArrayBaseFinder {
5959
using RT = bool;
6060

6161
ArrayBaseFinder(llvm::ArrayRef<Fortran::lower::FrontEndSymbol> syms)
62-
: controlVars(syms.begin(), syms.end()) {}
62+
: controlVars(syms) {}
6363

6464
template <typename T>
6565
void operator()(const T &x) {

flang/lib/Optimizer/Transforms/AffineDemotion.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,8 @@ class ConvertConversion : public mlir::OpRewritePattern<fir::ConvertOp> {
125125
};
126126

127127
mlir::Type convertMemRef(mlir::MemRefType type) {
128-
return fir::SequenceType::get(
129-
SmallVector<int64_t>(type.getShape().begin(), type.getShape().end()),
130-
type.getElementType());
128+
return fir::SequenceType::get(SmallVector<int64_t>(type.getShape()),
129+
type.getElementType());
131130
}
132131

133132
class StdAllocConversion : public mlir::OpRewritePattern<memref::AllocOp> {

flang/unittests/Optimizer/InternalNamesTest.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ struct DeconstructedName {
1919
DeconstructedName(llvm::ArrayRef<std::string> modules,
2020
llvm::ArrayRef<std::string> procs, std::int64_t blockId,
2121
llvm::StringRef name, llvm::ArrayRef<std::int64_t> kinds)
22-
: modules{modules.begin(), modules.end()}, procs{procs.begin(),
23-
procs.end()},
24-
blockId{blockId}, name{name}, kinds{kinds.begin(), kinds.end()} {}
22+
: modules{modules}, procs{procs}, blockId{blockId}, name{name},
23+
kinds{kinds} {}
2524

2625
bool isObjEqual(const NameUniquer::DeconstructedName &actualObj) {
2726
return actualObj.modules == modules && actualObj.procs == procs &&

0 commit comments

Comments
 (0)