[PATCH] D83061: [OpenMP] Implement TR8 `present` map type modifier in Clang (1/2)

Joel E. Denny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 17 16:38:09 PDT 2020


jdenny marked 2 inline comments as done.
jdenny added inline comments.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:7934-7940
+    // If any element has the present modifier, then make sure the runtime
+    // doesn't attempt to allocate the struct.
+    if (CurTypes.end() !=
+        llvm::find_if(CurTypes, [](OpenMPOffloadMappingFlags Type) {
+          return Type & OMP_MAP_PRESENT;
+        }))
+      Types.back() |= OMP_MAP_PRESENT;
----------------
ABataev wrote:
> Why do we need this extra stuff here?
For example:

```
#pragma omp target map(present, tofrom: s.x[0:3])
```

This generates 2 map entries:

  - `s`: 0x1020
  - `s.x`: 0x1000000001003

Without the above change, the 0x1000 is missing from the first entry.  As a result, `s` is allocated, and then the presence check for `s.x` incorrectly passes at run time.



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

https://reviews.llvm.org/D83061





More information about the cfe-commits mailing list