[PATCH] D105876: OMPIRBuilder for Interop directive

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 07:35:56 PDT 2021


ABataev added inline comments.


================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:6330-6331
+  if (const auto *C = S.getSingleClause<OMPInitClause>()) {
+    llvm::Value *InteropvarPtr =
+        EmitLValue(C->getInteropVar()).getPointer(*this);
+    llvm::omp::OMPInteropType InteropType = llvm::omp::OMPInteropType::Unknown;
----------------
This code is common for all `if-else` braches, move out of the conditional blocks?


================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:6335-6336
+      InteropType = llvm::omp::OMPInteropType::Target;
+    else if (C->getIsTargetSync())
+      InteropType = llvm::omp::OMPInteropType::TargetSync;
+    OMPBuilder.createOMPInteropInit(Builder, InteropvarPtr, InteropType, Device,
----------------
Can we have anything else rather than `C->getIsTargetSync()` here? If no, then it should look like this:
```
if (C->getIsTarget()) {
  InteropType = llvm::omp::OMPInteropType::Target;
} else {
  assert(C->getIsTargetSync() && "Expected ...");
  InteropType = llvm::omp::OMPInteropType::TargetSync;
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105876



More information about the llvm-commits mailing list