[flang-commits] [flang] [flang] Construct SmallVector with ArrayRef (NFC) (PR #101901)
via flang-commits
flang-commits at lists.llvm.org
Sun Aug 4 12:01:49 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/101901.diff
8 Files Affected:
- (modified) flang/include/flang/Lower/CallInterface.h (+1-1)
- (modified) flang/include/flang/Lower/IterationSpace.h (+1-1)
- (modified) flang/include/flang/Optimizer/Builder/BoxValue.h (+2-3)
- (modified) flang/include/flang/Optimizer/Support/InternalNames.h (+2-3)
- (modified) flang/lib/Lower/ConvertArrayConstructor.cpp (+2-4)
- (modified) flang/lib/Lower/IterationSpace.cpp (+1-1)
- (modified) flang/lib/Optimizer/Transforms/AffineDemotion.cpp (+2-3)
- (modified) flang/unittests/Optimizer/InternalNamesTest.cpp (+2-3)
``````````diff
diff --git a/flang/include/flang/Lower/CallInterface.h b/flang/include/flang/Lower/CallInterface.h
index a11e81b6593de..9a688330e8bd2 100644
--- a/flang/include/flang/Lower/CallInterface.h
+++ b/flang/include/flang/Lower/CallInterface.h
@@ -138,7 +138,7 @@ class CallInterface {
FirPlaceHolder(mlir::Type t, int passedPosition, Property p,
llvm::ArrayRef<mlir::NamedAttribute> attrs)
: type{t}, passedEntityPosition{passedPosition}, property{p},
- attributes{attrs.begin(), attrs.end()} {}
+ attributes{attrs} {}
/// Type for this input/output
mlir::Type type;
/// Position of related passedEntity in passedArguments.
diff --git a/flang/include/flang/Lower/IterationSpace.h b/flang/include/flang/Lower/IterationSpace.h
index 1359e22e23edd..ab52821432fb6 100644
--- a/flang/include/flang/Lower/IterationSpace.h
+++ b/flang/include/flang/Lower/IterationSpace.h
@@ -56,7 +56,7 @@ class IterationSpace {
explicit IterationSpace(const IterationSpace &from,
llvm::ArrayRef<mlir::Value> idxs)
: inArg(from.inArg), outRes(from.outRes), element(from.element),
- indices(idxs.begin(), idxs.end()) {}
+ indices(idxs) {}
/// Create a copy of the \p from IterationSpace and prepend the \p prefix
/// values and append the \p suffix values, respectively.
diff --git a/flang/include/flang/Optimizer/Builder/BoxValue.h b/flang/include/flang/Optimizer/Builder/BoxValue.h
index 9fdaa0b197179..5f9834bfb8ec9 100644
--- a/flang/include/flang/Optimizer/Builder/BoxValue.h
+++ b/flang/include/flang/Optimizer/Builder/BoxValue.h
@@ -127,8 +127,7 @@ class AbstractArrayBox {
AbstractArrayBox() = default;
AbstractArrayBox(llvm::ArrayRef<mlir::Value> extents,
llvm::ArrayRef<mlir::Value> lbounds)
- : extents{extents.begin(), extents.end()}, lbounds{lbounds.begin(),
- lbounds.end()} {}
+ : extents{extents}, lbounds{lbounds} {}
// Every array has extents that describe its shape.
const llvm::SmallVectorImpl<mlir::Value> &getExtents() const {
@@ -296,7 +295,7 @@ class BoxValue : public AbstractIrBox {
llvm::ArrayRef<mlir::Value> explicitParams,
llvm::ArrayRef<mlir::Value> explicitExtents = {})
: AbstractIrBox{addr, lbounds, explicitExtents},
- explicitParams{explicitParams.begin(), explicitParams.end()} {
+ explicitParams{explicitParams} {
assert(verify());
}
// TODO: check contiguous attribute of addr
diff --git a/flang/include/flang/Optimizer/Support/InternalNames.h b/flang/include/flang/Optimizer/Support/InternalNames.h
index ff23510922372..9e13b4a7668b7 100644
--- a/flang/include/flang/Optimizer/Support/InternalNames.h
+++ b/flang/include/flang/Optimizer/Support/InternalNames.h
@@ -56,9 +56,8 @@ struct NameUniquer {
DeconstructedName(llvm::ArrayRef<std::string> modules,
llvm::ArrayRef<std::string> procs, std::int64_t blockId,
llvm::StringRef name, llvm::ArrayRef<std::int64_t> kinds)
- : modules{modules.begin(), modules.end()}, procs{procs.begin(),
- procs.end()},
- blockId{blockId}, name{name}, kinds{kinds.begin(), kinds.end()} {}
+ : modules{modules}, procs{procs}, blockId{blockId}, name{name},
+ kinds{kinds} {}
llvm::SmallVector<std::string> modules;
llvm::SmallVector<std::string> procs;
diff --git a/flang/lib/Lower/ConvertArrayConstructor.cpp b/flang/lib/Lower/ConvertArrayConstructor.cpp
index 3c43cd20eb080..7e2142693eac5 100644
--- a/flang/lib/Lower/ConvertArrayConstructor.cpp
+++ b/flang/lib/Lower/ConvertArrayConstructor.cpp
@@ -194,8 +194,7 @@ class AsElementalStrategy : public StrategyBase {
fir::SequenceType declaredType, mlir::Value extent,
llvm::ArrayRef<mlir::Value> lengths)
: StrategyBase{stmtCtx, symMap}, shape{builder.genShape(loc, {extent})},
- lengthParams{lengths.begin(), lengths.end()},
- exprType{getExprType(declaredType)} {}
+ lengthParams{lengths}, exprType{getExprType(declaredType)} {}
static hlfir::ExprType getExprType(fir::SequenceType declaredType) {
// Note: 7.8 point 4: the dynamic type of an array constructor is its static
@@ -331,8 +330,7 @@ class RuntimeTempStrategy : public StrategyBase {
// Prepare the initial state of the allocatable descriptor with a
// deallocated status and all the available knowledge about the extent
// and length parameters.
- llvm::SmallVector<mlir::Value> emboxLengths(lengths.begin(),
- lengths.end());
+ llvm::SmallVector<mlir::Value> emboxLengths(lengths);
if (!extent)
extent = builder.createIntegerConstant(loc, builder.getIndexType(), 0);
if (missingLengthParameters) {
diff --git a/flang/lib/Lower/IterationSpace.cpp b/flang/lib/Lower/IterationSpace.cpp
index 9303536403837..63011483022b7 100644
--- a/flang/lib/Lower/IterationSpace.cpp
+++ b/flang/lib/Lower/IterationSpace.cpp
@@ -59,7 +59,7 @@ class ArrayBaseFinder {
using RT = bool;
ArrayBaseFinder(llvm::ArrayRef<Fortran::lower::FrontEndSymbol> syms)
- : controlVars(syms.begin(), syms.end()) {}
+ : controlVars(syms) {}
template <typename T>
void operator()(const T &x) {
diff --git a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
index c416302d671eb..d45f855c9078e 100644
--- a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
@@ -125,9 +125,8 @@ class ConvertConversion : public mlir::OpRewritePattern<fir::ConvertOp> {
};
mlir::Type convertMemRef(mlir::MemRefType type) {
- return fir::SequenceType::get(
- SmallVector<int64_t>(type.getShape().begin(), type.getShape().end()),
- type.getElementType());
+ return fir::SequenceType::get(SmallVector<int64_t>(type.getShape()),
+ type.getElementType());
}
class StdAllocConversion : public mlir::OpRewritePattern<memref::AllocOp> {
diff --git a/flang/unittests/Optimizer/InternalNamesTest.cpp b/flang/unittests/Optimizer/InternalNamesTest.cpp
index 058bbeef9b007..ab0b91622980a 100644
--- a/flang/unittests/Optimizer/InternalNamesTest.cpp
+++ b/flang/unittests/Optimizer/InternalNamesTest.cpp
@@ -19,9 +19,8 @@ struct DeconstructedName {
DeconstructedName(llvm::ArrayRef<std::string> modules,
llvm::ArrayRef<std::string> procs, std::int64_t blockId,
llvm::StringRef name, llvm::ArrayRef<std::int64_t> kinds)
- : modules{modules.begin(), modules.end()}, procs{procs.begin(),
- procs.end()},
- blockId{blockId}, name{name}, kinds{kinds.begin(), kinds.end()} {}
+ : modules{modules}, procs{procs}, blockId{blockId}, name{name},
+ kinds{kinds} {}
bool isObjEqual(const NameUniquer::DeconstructedName &actualObj) {
return actualObj.modules == modules && actualObj.procs == procs &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/101901
More information about the flang-commits
mailing list