[PATCH] D66247: [OpenMP] Fix target map for unused variables

Joel E. Denny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 13:09:49 PDT 2019


jdenny created this revision.
jdenny added reviewers: ABataev, jdoerfert, hfinkel, kkwli0.
Herald added a subscriber: guansong.
Herald added a project: clang.

Without this patch, each of the following `map` clauses doesn't map 
its variable into the target region because the variable is unused in
the target region, as discussed in D65835#1624669 <https://reviews.llvm.org/D65835#1624669>:

  #pragma omp target map(a)
  {}
  
  #pragma omp target map(a)
  #pragma omp teams private(a)
  {
    a++;
  }

This patch fixes that by marking all map clause variables for 
capturing.  That means the capturing analysis now sometimes runs on a
capture region within a combined construct, so this patch adjusts the 
analysis to be precise about how many capture regions remain in a
combined construct.  Otherwise, existing tests break.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66247

Files:
  clang/include/clang/Sema/ScopeInfo.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/target_map_codegen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66247.215212.patch
Type: text/x-patch
Size: 13188 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190814/93e324ed/attachment.bin>


More information about the cfe-commits mailing list