[PATCH] D83922: [OpenMP] Fix map clause for unused var: don't ignore it

Joel E. Denny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 15 18:06:39 PDT 2020


jdenny created this revision.
jdenny added reviewers: ABataev, jdoerfert, hfinkel, Meinersbur, kkwli0, grokos, sfantao, gtbercea, Hahnfeld.
Herald added subscribers: cfe-commits, sstefan1, guansong, yaxunl.
Herald added a project: clang.

For example, without this patch:

  $ cat test.c
  int main() {
    int x[3];
    #pragma omp target map(tofrom:x[0:3])
  #ifdef USE 
    x[0] = 1 
  #endif
    ;   
    return 0;
  }
  $ clang -fopenmp -fopenmp-targets=nvptx64-nvida-cuda -S -emit-llvm test.c
  $ grep '^@.offload_maptypes' test.ll
  $ echo $?
  1
  $ clang -fopenmp -fopenmp-targets=nvptx64-nvida-cuda -S -emit-llvm test.c \
          -DUSE
  $ grep '^@.offload_maptypes' test.ll
  @.offload_maptypes = private unnamed_addr constant [1 x i64] [i64 35] 

With this patch, both greps produce the same result.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83922

Files:
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/test/OpenMP/target_map_codegen.cpp
  clang/test/OpenMP/target_teams_map_codegen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83922.278342.patch
Type: text/x-patch
Size: 103430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200716/5f847e6f/attachment-0001.bin>


More information about the cfe-commits mailing list