Skip to content

Commit 9cf9721

Browse files
authored
[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.
1 parent e007551 commit 9cf9721

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

flang/lib/Lower/OpenMP.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,12 +2117,8 @@ static void createBodyOfOp(
21172117
for (const Fortran::semantics::Symbol *arg : args)
21182118
loopVarTypeSize = std::max(loopVarTypeSize, arg->GetUltimate().size());
21192119
mlir::Type loopVarType = getLoopVarType(converter, loopVarTypeSize);
2120-
llvm::SmallVector<mlir::Type> tiv;
2121-
llvm::SmallVector<mlir::Location> locs;
2122-
for (int i = 0; i < (int)args.size(); i++) {
2123-
tiv.push_back(loopVarType);
2124-
locs.push_back(loc);
2125-
}
2120+
llvm::SmallVector<mlir::Type> tiv(args.size(), loopVarType);
2121+
llvm::SmallVector<mlir::Location> locs(args.size(), loc);
21262122
firOpBuilder.createBlock(&op.getRegion(), {}, tiv, locs);
21272123
int argIndex = 0;
21282124
// The argument is not currently in memory, so make a temporary for the

0 commit comments

Comments
 (0)