From: Alexey Bataev Date: Fri, 2 Nov 2018 15:25:06 +0000 (+0000) Subject: [OPENMP]Change the mapping type for lambda captures. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0fd5745a9a680848e2ad92793c8dcefbf4a5cf3f;p=clang [OPENMP]Change the mapping type for lambda captures. The previously used combination `PTR_AND_OBJ | PRIVATE` could be used for mapping of some data in Fortran. Changed it to `PTR_AND_OBJ | LITERAL`. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345982 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp index a15918d4fb..04467a4fa8 100644 --- a/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/lib/CodeGen/CGOpenMPRuntime.cpp @@ -7556,7 +7556,7 @@ public: BasePointers.push_back(VDLVal.getPointer()); Pointers.push_back(ThisLVal.getPointer()); Sizes.push_back(CGF.getTypeSize(CGF.getContext().VoidPtrTy)); - Types.push_back(OMP_MAP_PTR_AND_OBJ | OMP_MAP_PRIVATE | + Types.push_back(OMP_MAP_PTR_AND_OBJ | OMP_MAP_LITERAL | OMP_MAP_MEMBER_OF | OMP_MAP_IMPLICIT); } for (const LambdaCapture &LC : RD->captures()) { @@ -7570,7 +7570,7 @@ public: Pointers.push_back(VarLVal.getPointer()); Sizes.push_back(CGF.getTypeSize( VD->getType().getCanonicalType().getNonReferenceType())); - Types.push_back(OMP_MAP_PTR_AND_OBJ | OMP_MAP_PRIVATE | + Types.push_back(OMP_MAP_PTR_AND_OBJ | OMP_MAP_LITERAL | OMP_MAP_MEMBER_OF | OMP_MAP_IMPLICIT); } } @@ -7581,7 +7581,7 @@ public: MapFlagsArrayTy &Types) const { for (unsigned I = 0, E = Types.size(); I < E; ++I) { // Set correct member_of idx for all implicit lambda captures. - if (Types[I] != (OMP_MAP_PTR_AND_OBJ | OMP_MAP_PRIVATE | + if (Types[I] != (OMP_MAP_PTR_AND_OBJ | OMP_MAP_LITERAL | OMP_MAP_MEMBER_OF | OMP_MAP_IMPLICIT)) continue; llvm::Value *BasePtr = *BasePointers[I]; diff --git a/test/OpenMP/nvptx_lambda_capturing.cpp b/test/OpenMP/nvptx_lambda_capturing.cpp index cf40c8b566..e041d5b2b7 100644 --- a/test/OpenMP/nvptx_lambda_capturing.cpp +++ b/test/OpenMP/nvptx_lambda_capturing.cpp @@ -13,13 +13,13 @@ #define HEADER // HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 4, i64 4, i64 0, i64 4, i64 40, i64 4, i64 4, i64 4, i64 8, i64 4, i64 4] -// HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 547, i64 547, i64 544, i64 33, i64 673, i64 1407374883553936, i64 1407374883553936, i64 1407374883553936, i64 1407374883553936, i64 1407374883553936, i64 800] +// HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 547, i64 547, i64 544, i64 33, i64 673, i64 1407374883554064, i64 1407374883554064, i64 1407374883554064, i64 1407374883554064, i64 1407374883554064, i64 800] // HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 4, i64 4, i64 4, i64 0, i64 4, i64 40, i64 4, i64 4, i64 4, i64 8, i64 4] -// HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 547, i64 547, i64 547, i64 544, i64 547, i64 673, i64 1688849860264592, i64 1688849860264592, i64 1688849860264592, i64 1688849860264592, i64 1688849860264592] +// HOST-DAG: = private unnamed_addr constant [11 x i64] [i64 547, i64 547, i64 547, i64 544, i64 547, i64 673, i64 1688849860264720, i64 1688849860264720, i64 1688849860264720, i64 1688849860264720, i64 1688849860264720] // HOST-DAG: = private unnamed_addr constant [3 x i64] [i64 4, i64 8, i64 8] -// HOST-DAG: = private unnamed_addr constant [3 x i64] [i64 547, i64 673, i64 562949953421968] +// HOST-DAG: = private unnamed_addr constant [3 x i64] [i64 547, i64 673, i64 562949953422096] // HOST-DAG: = private unnamed_addr constant [3 x i64] [i64 4, i64 8, i64 8] -// HOST-DAG: = private unnamed_addr constant [3 x i64] [i64 547, i64 673, i64 562949953421968] +// HOST-DAG: = private unnamed_addr constant [3 x i64] [i64 547, i64 673, i64 562949953422096] // CHECK-DAG: [[S:%.+]] = type { i32 } // CHECK-DAG: [[CAP1:%.+]] = type { [[S]]* } // CHECK-DAG: [[CAP2:%.+]] = type { i32*, i32*, i32*, i32**, i32* }