[Openmp-commits] [openmp] Fix mapping of struct to device (PR #70821)

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Tue Oct 31 10:08:53 PDT 2023


================
@@ -573,11 +573,38 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
                     void **ArgMappers, AsyncInfoTy &AsyncInfo,
                     bool FromMapper) {
   TIMESCOPE_WITH_IDENT(Loc);
+
+  // Initialize new map type with old type:
+  SmallVector<int64_t> NewArgTypes = SmallVector<int64_t>(ArgNum);
+  for (int32_t I = 0; I < ArgNum; ++I) {
+    NewArgTypes[I] = ArgTypes[I];
+  }
----------------
jhuber6 wrote:

There may be a constructor that can copy from an iterator as well to remove the need for this loop, something like `(ArgTypes, ArgTypes + ArgNum)`. I forget the syntax exactly. `llvm::copy` should work if you make a range based iterator as well.

https://github.com/llvm/llvm-project/pull/70821


More information about the Openmp-commits mailing list