[Openmp-commits] [PATCH] D94095: [libomptarget] Allow calls to omp_target_memcpy with 0 size.

George Rokos via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 5 12:06:57 PST 2021


grokos updated this revision to Diff 314683.
grokos added a comment.

Slight optimization - removed condition from the hot path.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94095

Files:
  openmp/libomptarget/src/api.cpp


Index: openmp/libomptarget/src/api.cpp
===================================================================
--- openmp/libomptarget/src/api.cpp
+++ openmp/libomptarget/src/api.cpp
@@ -137,6 +137,11 @@
       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;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94095.314683.patch
Type: text/x-patch
Size: 529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210105/100e5da0/attachment.bin>


More information about the Openmp-commits mailing list