[flang-commits] [flang] 9cf9721 - [flang][OpenMP] Avoid unnecessary init loop, use constructor instead,… (#75482)
via flang-commits
flang-commits at lists.llvm.org
Thu Dec 14 09:24:21 PST 2023
Author: Krzysztof Parzyszek
Date: 2023-12-14T11:24:17-06:00
New Revision: 9cf9721dcf1c832a1374e453500b8f7979e65a84
URL: https://github.com/llvm/llvm-project/commit/9cf9721dcf1c832a1374e453500b8f7979e65a84
DIFF: https://github.com/llvm/llvm-project/commit/9cf9721dcf1c832a1374e453500b8f7979e65a84.diff
LOG: [flang][OpenMP] Avoid unnecessary init loop, use constructor instead,… (#75482)
… NFC
SmallVector has a constructor that fills it with a number of copies of a
given value. Use it instead of a loop that does the same thing.
Added:
Modified:
flang/lib/Lower/OpenMP.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index eeba87fcd15116..12b8ea82884d9d 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -2117,12 +2117,8 @@ static void createBodyOfOp(
for (const Fortran::semantics::Symbol *arg : args)
loopVarTypeSize = std::max(loopVarTypeSize, arg->GetUltimate().size());
mlir::Type loopVarType = getLoopVarType(converter, loopVarTypeSize);
- llvm::SmallVector<mlir::Type> tiv;
- llvm::SmallVector<mlir::Location> locs;
- for (int i = 0; i < (int)args.size(); i++) {
- tiv.push_back(loopVarType);
- locs.push_back(loc);
- }
+ llvm::SmallVector<mlir::Type> tiv(args.size(), loopVarType);
+ llvm::SmallVector<mlir::Location> locs(args.size(), loc);
firOpBuilder.createBlock(&op.getRegion(), {}, tiv, locs);
int argIndex = 0;
// The argument is not currently in memory, so make a temporary for the
More information about the flang-commits
mailing list