[Openmp-commits] [openmp] fa6c275 - [OpenMP][NFC] Eliminate CopyMember from targetDataEnd

Joel E. Denny via Openmp-commits openmp-commits at lists.llvm.org
Wed Sep 1 14:38:10 PDT 2021


Author: Joel E. Denny
Date: 2021-09-01T17:31:42-04:00
New Revision: fa6c275505632846260f610b71656ddde1d88598

URL: https://github.com/llvm/llvm-project/commit/fa6c275505632846260f610b71656ddde1d88598
DIFF: https://github.com/llvm/llvm-project/commit/fa6c275505632846260f610b71656ddde1d88598.diff

LOG: [OpenMP][NFC] Eliminate CopyMember from targetDataEnd

This patch is based on comments in D105990.  It is NFC according to
the following observations:

1. `CopyMember` is computed as `!IsHostPtr && IsLast`.
2. `DelEntry` is true only if `IsLast` is true.

We apply those observations in order:

```
if ((DelEntry || Always || CopyMember) && !IsHostPtr)

if ((DelEntry || Always || IsLast) && !IsHostPtr)

if ((Always || IsLast) && !IsHostPtr)
```

Reviewed By: grokos

Differential Revision: https://reviews.llvm.org/D107926

Added: 
    

Modified: 
    openmp/libomptarget/src/omptarget.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp
index 380e37e3cf15..fe50563d94a6 100644
--- a/openmp/libomptarget/src/omptarget.cpp
+++ b/openmp/libomptarget/src/omptarget.cpp
@@ -737,13 +737,7 @@ int targetDataEnd(ident_t *loc, DeviceTy &Device, int32_t ArgNum,
       // Move data back to the host
       if (ArgTypes[I] & OMP_TGT_MAPTYPE_FROM) {
         bool Always = ArgTypes[I] & OMP_TGT_MAPTYPE_ALWAYS;
-        bool CopyMember = false;
-        if (!IsHostPtr) {
-          if (IsLast)
-            CopyMember = true;
-        }
-
-        if ((DelEntry || Always || CopyMember) && !IsHostPtr) {
+        if ((Always || IsLast) && !IsHostPtr) {
           DP("Moving %" PRId64 " bytes (tgt:" DPxMOD ") -> (hst:" DPxMOD ")\n",
              DataSize, DPxPTR(TgtPtrBegin), DPxPTR(HstPtrBegin));
           Ret = Device.retrieveData(HstPtrBegin, TgtPtrBegin, DataSize,


        


More information about the Openmp-commits mailing list