[PATCH] D92064: [flang][openacc] Remove duplicated code for clause lowering

Eric Schweitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 4 16:59:16 PST 2021


schweitz accepted this revision.
schweitz added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: flang/lib/Lower/OpenACC.cpp:26
+// Special value for * passed in device_type or gang clauses.
+static constexpr std::int64_t starCst{-1};
+
----------------
I think the prevailing style throughout LLVM, Clang, MLIR is to write the initializer as `= -1;`

Does it make sense to put this in a header file?


================
Comment at: flang/lib/Lower/OpenACC.cpp:129
+  const auto &asyncClauseValue = asyncClause->v;
+  if (asyncClauseValue) { // async has a value.
+    async = fir::getBase(converter.genExprValue(
----------------
Could fold these two lines as
```
  if (asyncClause->v.has_value())
```



================
Comment at: flang/lib/Lower/OpenACC.cpp:146
+          converter.genExprValue(*Fortran::semantics::GetExpr(scalarIntExpr)));
+      operands.push_back(expr);
+    }
----------------
Should the type of `expr` be cast to `index` here to be consistent with `star` (in the else branch)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92064/new/

https://reviews.llvm.org/D92064



More information about the llvm-commits mailing list