[llvm-branch-commits] [openmp] dec0290 - [libomptarget] Allow calls to omp_target_memcpy with 0 size.

George Rokos via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 5 16:11:12 PST 2021


Author: George Rokos
Date: 2021-01-05T16:03:53-08:00
New Revision: dec02904d2675a14cd9c7b5a306d3f4f85c2abca

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

LOG: [libomptarget] Allow calls to omp_target_memcpy with 0 size.

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

Added: 
    

Modified: 
    openmp/libomptarget/src/api.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/src/api.cpp b/openmp/libomptarget/src/api.cpp
index 58f7cec2fdd6..2d376109308b 100644
--- a/openmp/libomptarget/src/api.cpp
+++ b/openmp/libomptarget/src/api.cpp
@@ -137,6 +137,11 @@ EXTERN int omp_target_memcpy(void *dst, void *src, size_t length,
       DPxPTR(src), dst_offset, src_offset, length);
 
   if (!dst || !src || length <= 0) {
+    if (length == 0) {
+      DP("Call to omp_target_memcpy with zero length, nothing to do\n");
+      return OFFLOAD_SUCCESS;
+    }
+
     REPORT("Call to omp_target_memcpy with invalid arguments\n");
     return OFFLOAD_FAIL;
   }


        


More information about the llvm-branch-commits mailing list