[flang-commits] [flang] [flang][OpenMP] Implement lastprivate with collapse (PR #99500)
via flang-commits
flang-commits at lists.llvm.org
Thu Jul 18 07:35:18 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 290184880ae22541738e280397da33fe515e4c86 c4816482a7b2f7717cde731b419d23a39e5407da --extensions h,cpp -- flang/lib/Lower/OpenMP/DataSharingProcessor.cpp flang/lib/Lower/OpenMP/DataSharingProcessor.h flang/lib/Lower/OpenMP/OpenMP.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
index a172633d2f..c1d4c089df 100644
--- a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
@@ -219,7 +219,6 @@ void DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) {
mlir::Operation *lastOper = loopOp.getRegion().back().getTerminator();
firOpBuilder.setInsertionPoint(lastOper);
-
mlir::Value cmpOp;
llvm::SmallVector<mlir::Value> vs;
vs.reserve(loopOp.getIVs().size());
@@ -241,7 +240,7 @@ void DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) {
loc, negativeStep, vLT, vGT);
if (cmpOp) {
- cmpOp = firOpBuilder.create<mlir::arith::AndIOp>(loc, cmpOp, icmpOp);
+ cmpOp = firOpBuilder.create<mlir::arith::AndIOp>(loc, cmpOp, icmpOp);
} else {
cmpOp = icmpOp;
}
@@ -249,7 +248,7 @@ void DataSharingProcessor::insertLastPrivateCompare(mlir::Operation *op) {
auto ifOp = firOpBuilder.create<fir::IfOp>(loc, cmpOp, /*else*/ false);
firOpBuilder.setInsertionPointToStart(&ifOp.getThenRegion().front());
- for (auto [v,loopIV] : llvm::zip_equal(vs, loopIVs)) {
+ for (auto [v, loopIV] : llvm::zip_equal(vs, loopIVs)) {
assert(loopIV && "loopIV was not set");
firOpBuilder.createStoreWithConvert(loc, v, loopIV);
}
diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.h b/flang/lib/Lower/OpenMP/DataSharingProcessor.h
index f9f0563da6..1e9d07ec13 100644
--- a/flang/lib/Lower/OpenMP/DataSharingProcessor.h
+++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.h
@@ -147,9 +147,7 @@ public:
void processStep1(mlir::omp::PrivateClauseOps *clauseOps = nullptr);
void processStep2(mlir::Operation *op, bool isLoop);
- void pushLoopIV(mlir::Value iv) {
- loopIVs.push_back(iv);
- }
+ void pushLoopIV(mlir::Value iv) { loopIVs.push_back(iv); }
const llvm::SetVector<const semantics::Symbol *> &
getAllSymbolsToPrivatize() const {
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 0881fdf788..625a8c83c3 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -678,8 +678,8 @@ static void createBodyOfOp(mlir::Operation &op, const OpWithBodyGenInfo &info,
tempDsp->processStep2(privatizationTopLevelOp, isLoop);
} else {
if (isLoop && regionArgs.size() > 0) {
- for (const auto& regionArg : regionArgs) {
- info.dsp->pushLoopIV( info.converter.getSymbolAddress(*regionArg));
+ for (const auto ®ionArg : regionArgs) {
+ info.dsp->pushLoopIV(info.converter.getSymbolAddress(*regionArg));
}
}
info.dsp->processStep2(privatizationTopLevelOp, isLoop);
``````````
</details>
https://github.com/llvm/llvm-project/pull/99500
More information about the flang-commits
mailing list