[PATCH] D137313: [NFC] Remove redundant loads when has_device_addr is used.

Jennifer Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 15:14:18 PDT 2022


jyu2 added a comment.

In D137313#3906487 <https://reviews.llvm.org/D137313#3906487>, @ABataev wrote:

> Do we have a runtime test for this? Would be good to try to test it if the offloading fails and the host version is executed instead.

I have runtime test in https://reviews.llvm.org/D134268
openmp/libomptarget/test/mapping/target_has_device_addr.c where

void bar() {

  short x[10];
  short *xp = &x[0];
  
  x[1] = 111;

#pragma omp target data map(tofrom : xp [0:2]) use_device_addr(xp [0:2])
#pragma omp target has_device_addr(xp [0:2])

  {
    xp[1] = 222;
    // CHECK: 222
    printf("%d %p\n", xp[1], &xp[1]);
  }
  // CHECK: 222
  printf("%d %p\n", xp[1], &xp[1]);

}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137313



More information about the cfe-commits mailing list