summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-11-15 13:15:20 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-11-15 13:15:20 +0000
commitf7300d5cb168b5504ffcefe715c8218936757a59 (patch)
tree58901467448670674930f0a2e66b937e4f84c32f
parent61c3046408976846f85af67b68bf82a6e8103c61 (diff)
downloadbcm5719-llvm-f7300d5cb168b5504ffcefe715c8218936757a59.tar.gz
bcm5719-llvm-f7300d5cb168b5504ffcefe715c8218936757a59.zip
[OPENMP] Fix for PR30632: Name mangling issue.
Reworked fix after comments from Richard Smith. We must skip all CapturedDecl-based contexts when trying to get correct mangling number context. llvm-svn: 286953
-rw-r--r--clang/lib/Sema/SemaLambda.cpp7
-rw-r--r--clang/test/OpenMP/for_lastprivate_codegen.cpp9
2 files changed, 10 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index fb3ac072f1e..0715650b8a2 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -317,12 +317,13 @@ Sema::getCurrentMangleNumberContext(const DeclContext *DC,
case Normal: {
// -- the bodies of non-exported nonspecialized template functions
// -- the bodies of inline functions
- auto *CD = dyn_cast<CapturedDecl>(CurContext);
if ((IsInNonspecializedTemplate &&
!(ManglingContextDecl && isa<ParmVarDecl>(ManglingContextDecl))) ||
- isInInlineFunction(CurContext) || CD) {
+ isInInlineFunction(CurContext)) {
ManglingContextDecl = nullptr;
- return &Context.getManglingNumberContext(CD ? CD->getParent() : DC);
+ while (auto *CD = dyn_cast<CapturedDecl>(DC))
+ DC = CD->getParent();
+ return &Context.getManglingNumberContext(DC);
}
ManglingContextDecl = nullptr;
diff --git a/clang/test/OpenMP/for_lastprivate_codegen.cpp b/clang/test/OpenMP/for_lastprivate_codegen.cpp
index 4df4fef7c76..f0fba042c58 100644
--- a/clang/test/OpenMP/for_lastprivate_codegen.cpp
+++ b/clang/test/OpenMP/for_lastprivate_codegen.cpp
@@ -40,7 +40,7 @@ struct SS {
for (a = 0; a < 2; ++a)
#ifdef LAMBDA
[&]() {
- ++this->a, --b, (this)->c /= 1;
+ --this->a, ++b, (this)->c *= 2;
#pragma omp parallel
#pragma omp for lastprivate(b)
for (b = 0; b < 2; ++b)
@@ -189,7 +189,7 @@ int main() {
// LAMBDA: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[SS_TY]]*)* [[SS_MICROTASK:@.+]] to void
// LAMBDA: call void @__kmpc_for_static_init_4(
// LAMBDA-NOT: getelementptr inbounds [[SS_TY]], [[SS_TY]]* %{{.+}}, i32 0, i32 0
- // LAMBDA: call void {{.+}} [[SS_LAMBDA:@[^ ]+]]
+ // LAMBDA: call{{.*}} void [[SS_LAMBDA1:@[^ ]+]]
// LAMBDA: call void @__kmpc_for_static_fini(%
// LAMBDA: ret
@@ -199,7 +199,7 @@ int main() {
// LAMBDA: getelementptr {{.*}}[[SS_TY]], [[SS_TY]]* %{{.*}}, i32 0, i32 2
// LAMBDA: call void @__kmpc_for_static_init_4(
// LAMBDA-NOT: getelementptr {{.*}}[[SS_TY]], [[SS_TY]]*
- // LAMBDA: call{{.*}} void
+ // LAMBDA: call{{.*}} void [[SS_LAMBDA:@[^ ]+]]
// LAMBDA: call void @__kmpc_for_static_fini(
// LAMBDA: br i1
// LAMBDA: [[B_REF:%.+]] = getelementptr {{.*}}[[SS_TY]], [[SS_TY]]* %{{.*}}, i32 0, i32 1
@@ -235,6 +235,9 @@ int main() {
// LAMBDA: br label
// LAMBDA: ret void
+ // LAMBDA: define internal void @{{.+}}(i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [[SS_TY]]* %{{.+}})
+ // LAMBDA: ret void
+
// LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* noalias %{{.+}}, i32* noalias %{{.+}}, i32* dereferenceable(4) [[SIVAR:%.+]])
// LAMBDA: alloca i{{[0-9]+}},
// LAMBDA: alloca i{{[0-9]+}},
OpenPOWER on IntegriCloud