diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2017-08-22 17:54:52 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-08-22 17:54:52 +0000 |
| commit | 6a71f364f175a94a92cb26908b36d972734a611d (patch) | |
| tree | 77037ca5b4040397e681d8951cddc290b944665a /clang/test/OpenMP/target_map_codegen.cpp | |
| parent | 6bfeba24d39ed0915ebb5867df650ac7db3eb5dd (diff) | |
| download | bcm5719-llvm-6a71f364f175a94a92cb26908b36d972734a611d.tar.gz bcm5719-llvm-6a71f364f175a94a92cb26908b36d972734a611d.zip | |
[OPENMP] Fix for PR34014: OpenMP 4.5: Target construct in static method
of class fails to map class static variable.
If the global variable is captured and it has several redeclarations,
sometimes it may lead to a compiler crash. Patch fixes this by working
only with canonical declarations.
llvm-svn: 311479
Diffstat (limited to 'clang/test/OpenMP/target_map_codegen.cpp')
| -rw-r--r-- | clang/test/OpenMP/target_map_codegen.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/OpenMP/target_map_codegen.cpp b/clang/test/OpenMP/target_map_codegen.cpp index 69e80bb9505..820815c8c28 100644 --- a/clang/test/OpenMP/target_map_codegen.cpp +++ b/clang/test/OpenMP/target_map_codegen.cpp @@ -15,12 +15,30 @@ // RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32 #ifdef CK1 +class B { +public: + static double VAR; + B() { + } + + static void modify(int &res) { +#pragma omp target map(tofrom \ + : res) + { + res = B::VAR; + } + } +}; +double B::VAR = 1.0; + // CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4] // Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_IS_FIRST = 288 // CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i32] [i32 288] // CK1-LABEL: implicit_maps_integer void implicit_maps_integer (int a){ + // CK1: call void{{.*}}modify + B::modify(a); int i = a; // CK1-DAG: call i32 @__tgt_target(i32 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) |

