From 3ce5d827fc857b79e6de4d3d86c7443f1551fc4e Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Thu, 29 Nov 2018 21:21:32 +0000 Subject: [OPENMP][NVPTX]Call get __kmpc_global_thread_num in worker after initialization. Function __kmpc_global_thread_num should be called only after initialization, not earlier. llvm-svn: 347919 --- clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp index d4b599eeff4..2bc98f6178b 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -1504,6 +1504,8 @@ void CGOpenMPRuntimeNVPTX::emitWorkerLoop(CodeGenFunction &CGF, // Signal start of parallel region. CGF.EmitBlock(ExecuteBB); + // Skip initialization. + setLocThreadIdInsertPt(CGF, /*AtCurrentPoint=*/true); // Process work items: outlined parallel functions. for (llvm::Function *W : Work) { @@ -1564,6 +1566,8 @@ void CGOpenMPRuntimeNVPTX::emitWorkerLoop(CodeGenFunction &CGF, // Exit target region. CGF.EmitBlock(ExitBB); + // Skip initialization. + clearLocThreadIdInsertPt(CGF); } /// Returns specified OpenMP runtime function for the current OpenMP -- cgit v1.2.3