<div dir="ltr">Rough guess: That seems like a lot of code changes for relatively little test changes - are all parts of this change tested? (Might well be - just lots of layers to plumb things through - but if there's lots of places that get locations and only a few of those are tested, maybe this could use more coverage?)<br><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 4, 2018 at 11:46 AM Alexey Bataev via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: abataev<br>
Date: Thu Jan  4 11:45:16 2018<br>
New Revision: 321816<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=321816&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=321816&view=rev</a><br>
Log:<br>
[OPENMP] Add debug info for generated functions.<br>
<br>
Most of the generated functions for the OpenMP were generated with<br>
disabled debug info. Patch fixes this for better user experience.<br>
<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp<br>
    cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h<br>
    cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp<br>
    cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.h<br>
    cfe/trunk/test/OpenMP/target_parallel_debug_codegen.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=321816&r1=321815&r2=321816&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=321816&r1=321815&r2=321816&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu Jan  4 11:45:16 2018<br>
@@ -1216,7 +1216,8 @@ emitCombinerOrInitializer(CodeGenModule<br>
   CodeGenFunction CGF(CGM);<br>
   // Map "T omp_in;" variable to "*omp_in_parm" value in all expressions.<br>
   // Map "T omp_out;" variable to "*omp_out_parm" value in all expressions.<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FnInfo, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FnInfo, Args, In->getLocation(),<br>
+                    Out->getLocation());<br>
   CodeGenFunction::OMPPrivateScope Scope(CGF);<br>
   Address AddrIn = CGF.GetAddrOfLocalVar(&OmpInParm);<br>
   Scope.addPrivate(In, [&CGF, AddrIn, PtrTy]() -> Address {<br>
@@ -2383,7 +2384,8 @@ llvm::Function *CGOpenMPRuntime::emitThr<br>
       // threadprivate copy of the variable VD<br>
       CodeGenFunction CtorCGF(CGM);<br>
       FunctionArgList Args;<br>
-      ImplicitParamDecl Dst(CGM.getContext(), CGM.getContext().VoidPtrTy,<br>
+      ImplicitParamDecl Dst(CGM.getContext(), /*DC=*/nullptr, Loc,<br>
+                            /*Id=*/nullptr, CGM.getContext().VoidPtrTy,<br>
                             ImplicitParamDecl::Other);<br>
       Args.push_back(&Dst);<br>
<br>
@@ -2393,13 +2395,13 @@ llvm::Function *CGOpenMPRuntime::emitThr<br>
       auto Fn = CGM.CreateGlobalInitOrDestructFunction(<br>
           FTy, ".__kmpc_global_ctor_.", FI, Loc);<br>
       CtorCGF.StartFunction(GlobalDecl(), CGM.getContext().VoidPtrTy, Fn, FI,<br>
-                            Args, SourceLocation());<br>
+                            Args, Loc, Loc);<br>
       auto ArgVal = CtorCGF.EmitLoadOfScalar(<br>
           CtorCGF.GetAddrOfLocalVar(&Dst), /*Volatile=*/false,<br>
           CGM.getContext().VoidPtrTy, Dst.getLocation());<br>
       Address Arg = Address(ArgVal, VDAddr.getAlignment());<br>
-      Arg = CtorCGF.Builder.CreateElementBitCast(Arg,<br>
-                                             CtorCGF.ConvertTypeForMem(ASTTy));<br>
+      Arg = CtorCGF.Builder.CreateElementBitCast(<br>
+          Arg, CtorCGF.ConvertTypeForMem(ASTTy));<br>
       CtorCGF.EmitAnyExprToMem(Init, Arg, Init->getType().getQualifiers(),<br>
                                /*IsInitializer=*/true);<br>
       ArgVal = CtorCGF.EmitLoadOfScalar(<br>
@@ -2414,7 +2416,8 @@ llvm::Function *CGOpenMPRuntime::emitThr<br>
       // of the variable VD<br>
       CodeGenFunction DtorCGF(CGM);<br>
       FunctionArgList Args;<br>
-      ImplicitParamDecl Dst(CGM.getContext(), CGM.getContext().VoidPtrTy,<br>
+      ImplicitParamDecl Dst(CGM.getContext(), /*DC=*/nullptr, Loc,<br>
+                            /*Id=*/nullptr, CGM.getContext().VoidPtrTy,<br>
                             ImplicitParamDecl::Other);<br>
       Args.push_back(&Dst);<br>
<br>
@@ -2425,7 +2428,7 @@ llvm::Function *CGOpenMPRuntime::emitThr<br>
           FTy, ".__kmpc_global_dtor_.", FI, Loc);<br>
       auto NL = ApplyDebugLocation::CreateEmpty(DtorCGF);<br>
       DtorCGF.StartFunction(GlobalDecl(), CGM.getContext().VoidTy, Fn, FI, Args,<br>
-                            SourceLocation());<br>
+                            Loc, Loc);<br>
       // Create a scope with an artificial location for the body of this function.<br>
       auto AL = ApplyDebugLocation::CreateArtificial(DtorCGF);<br>
       auto ArgVal = DtorCGF.EmitLoadOfScalar(<br>
@@ -2469,7 +2472,7 @@ llvm::Function *CGOpenMPRuntime::emitThr<br>
       FunctionArgList ArgList;<br>
       InitCGF.StartFunction(GlobalDecl(), CGM.getContext().VoidTy, InitFunction,<br>
                             CGM.getTypes().arrangeNullaryFunction(), ArgList,<br>
-                            Loc);<br>
+                            Loc, Loc);<br>
       emitThreadPrivateVarInit(InitCGF, VDAddr, Ctor, CopyCtor, Dtor, Loc);<br>
       InitCGF.FinishFunction();<br>
       return InitFunction;<br>
@@ -2783,12 +2786,15 @@ static Address emitAddrOfVarFromArray(Co<br>
 static llvm::Value *emitCopyprivateCopyFunction(<br>
     CodeGenModule &CGM, llvm::Type *ArgsType,<br>
     ArrayRef<const Expr *> CopyprivateVars, ArrayRef<const Expr *> DestExprs,<br>
-    ArrayRef<const Expr *> SrcExprs, ArrayRef<const Expr *> AssignmentOps) {<br>
+    ArrayRef<const Expr *> SrcExprs, ArrayRef<const Expr *> AssignmentOps,<br>
+    SourceLocation Loc) {<br>
   auto &C = CGM.getContext();<br>
   // void copy_func(void *LHSArg, void *RHSArg);<br>
   FunctionArgList Args;<br>
-  ImplicitParamDecl LHSArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
-  ImplicitParamDecl RHSArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl LHSArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, C.VoidPtrTy,<br>
+                           ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl RHSArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, C.VoidPtrTy,<br>
+                           ImplicitParamDecl::Other);<br>
   Args.push_back(&LHSArg);<br>
   Args.push_back(&RHSArg);<br>
   auto &CGFI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, Args);<br>
@@ -2797,7 +2803,7 @@ static llvm::Value *emitCopyprivateCopyF<br>
       ".omp.copyprivate.copy_func", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, CGFI);<br>
   CodeGenFunction CGF(CGM);<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args, Loc, Loc);<br>
   // Dest = (void*[n])(LHSArg);<br>
   // Src = (void*[n])(RHSArg);<br>
   Address LHS(CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(<br>
@@ -2888,7 +2894,7 @@ void CGOpenMPRuntime::emitSingleRegion(C<br>
     // threads in the corresponding parallel region.<br>
     auto *CpyFn = emitCopyprivateCopyFunction(<br>
         CGM, CGF.ConvertTypeForMem(CopyprivateArrayTy)->getPointerTo(),<br>
-        CopyprivateVars, SrcExprs, DstExprs, AssignmentOps);<br>
+        CopyprivateVars, SrcExprs, DstExprs, AssignmentOps, Loc);<br>
     auto *BufSize = CGF.getTypeSize(CopyprivateArrayTy);<br>
     Address CL =<br>
       CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(CopyprivateList,<br>
@@ -3399,11 +3405,13 @@ createOffloadingBinaryDescriptorFunction<br>
   Args.push_back(&DummyPtr);<br>
<br>
   CodeGenFunction CGF(CGM);<br>
+  // Disable debug info for global (de-)initializer because they are not part of<br>
+  // some particular construct.<br>
+  CGF.disableDebugInfo();<br>
   auto &FI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, Args);<br>
   auto FTy = CGM.getTypes().GetFunctionType(FI);<br>
-  auto *Fn =<br>
-      CGM.CreateGlobalInitOrDestructFunction(FTy, Name, FI, SourceLocation());<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FI, Args, SourceLocation());<br>
+  auto *Fn = CGM.CreateGlobalInitOrDestructFunction(FTy, Name, FI);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FI, Args);<br>
   Codegen(CGF);<br>
   CGF.FinishFunction();<br>
   return Fn;<br>
@@ -3411,7 +3419,6 @@ createOffloadingBinaryDescriptorFunction<br>
<br>
 llvm::Function *<br>
 CGOpenMPRuntime::createOffloadingBinaryDescriptorRegistration() {<br>
-<br>
   // If we don't have entries or if we are emitting code for the device, we<br>
   // don't need to do anything.<br>
   if (CGM.getLangOpts().OpenMPIsDevice || OffloadEntriesInfoManager.empty())<br>
@@ -3945,7 +3952,8 @@ emitProxyTaskFunction(CodeGenModule &CGM<br>
                              ".omp_task_entry.", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskEntry, TaskEntryFnInfo);<br>
   CodeGenFunction CGF(CGM);<br>
-  CGF.StartFunction(GlobalDecl(), KmpInt32Ty, TaskEntry, TaskEntryFnInfo, Args);<br>
+  CGF.StartFunction(GlobalDecl(), KmpInt32Ty, TaskEntry, TaskEntryFnInfo, Args,<br>
+                    Loc, Loc);<br>
<br>
   // TaskFunction(gtid, tt->task_data.part_id, &tt->privates, task_privates_map,<br>
   // tt,<br>
@@ -4045,9 +4053,8 @@ static llvm::Value *emitDestructorsFunct<br>
   CGM.SetInternalFunctionAttributes(/*D=*/nullptr, DestructorFn,<br>
                                     DestructorFnInfo);<br>
   CodeGenFunction CGF(CGM);<br>
-  CGF.disableDebugInfo();<br>
   CGF.StartFunction(GlobalDecl(), KmpInt32Ty, DestructorFn, DestructorFnInfo,<br>
-                    Args);<br>
+                    Args, Loc, Loc);<br>
<br>
   LValue Base = CGF.EmitLoadOfPointerLValue(<br>
       CGF.GetAddrOfLocalVar(&TaskTypeArg),<br>
@@ -4139,9 +4146,8 @@ emitTaskPrivateMappingFunction(CodeGenMo<br>
   TaskPrivatesMap->removeFnAttr(llvm::Attribute::OptimizeNone);<br>
   TaskPrivatesMap->addFnAttr(llvm::Attribute::AlwaysInline);<br>
   CodeGenFunction CGF(CGM);<br>
-  CGF.disableDebugInfo();<br>
   CGF.StartFunction(GlobalDecl(), C.VoidTy, TaskPrivatesMap,<br>
-                    TaskPrivatesMapFnInfo, Args);<br>
+                    TaskPrivatesMapFnInfo, Args, Loc, Loc);<br>
<br>
   // *privi = &.privates.privi;<br>
   LValue Base = CGF.EmitLoadOfPointerLValue(<br>
@@ -4322,8 +4328,8 @@ emitTaskDupFunction(CodeGenModule &CGM,<br>
                              ".omp_task_dup.", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskDup, TaskDupFnInfo);<br>
   CodeGenFunction CGF(CGM);<br>
-  CGF.disableDebugInfo();<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, TaskDup, TaskDupFnInfo, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, TaskDup, TaskDupFnInfo, Args, Loc,<br>
+                    Loc);<br>
<br>
   LValue TDBase = CGF.EmitLoadOfPointerLValue(<br>
       CGF.GetAddrOfLocalVar(&DstArg),<br>
@@ -4943,15 +4949,17 @@ static void emitReductionCombiner(CodeGe<br>
 }<br>
<br>
 llvm::Value *CGOpenMPRuntime::emitReductionFunction(<br>
-    CodeGenModule &CGM, llvm::Type *ArgsType, ArrayRef<const Expr *> Privates,<br>
-    ArrayRef<const Expr *> LHSExprs, ArrayRef<const Expr *> RHSExprs,<br>
-    ArrayRef<const Expr *> ReductionOps) {<br>
+    CodeGenModule &CGM, SourceLocation Loc, llvm::Type *ArgsType,<br>
+    ArrayRef<const Expr *> Privates, ArrayRef<const Expr *> LHSExprs,<br>
+    ArrayRef<const Expr *> RHSExprs, ArrayRef<const Expr *> ReductionOps) {<br>
   auto &C = CGM.getContext();<br>
<br>
   // void reduction_func(void *LHSArg, void *RHSArg);<br>
   FunctionArgList Args;<br>
-  ImplicitParamDecl LHSArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
-  ImplicitParamDecl RHSArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl LHSArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, C.VoidPtrTy,<br>
+                           ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl RHSArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, C.VoidPtrTy,<br>
+                           ImplicitParamDecl::Other);<br>
   Args.push_back(&LHSArg);<br>
   Args.push_back(&RHSArg);<br>
   auto &CGFI = CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, Args);<br>
@@ -4960,7 +4968,7 @@ llvm::Value *CGOpenMPRuntime::emitReduct<br>
       ".omp.reduction.reduction_func", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, CGFI);<br>
   CodeGenFunction CGF(CGM);<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args, Loc, Loc);<br>
<br>
   // Dst = (void*[n])(LHSArg);<br>
   // Src = (void*[n])(RHSArg);<br>
@@ -5149,8 +5157,8 @@ void CGOpenMPRuntime::emitReduction(Code<br>
<br>
   // 2. Emit reduce_func().<br>
   auto *ReductionFn = emitReductionFunction(<br>
-      CGM, CGF.ConvertTypeForMem(ReductionArrayTy)->getPointerTo(), Privates,<br>
-      LHSExprs, RHSExprs, ReductionOps);<br>
+      CGM, Loc, CGF.ConvertTypeForMem(ReductionArrayTy)->getPointerTo(),<br>
+      Privates, LHSExprs, RHSExprs, ReductionOps);<br>
<br>
   // 3. Create static kmp_critical_name lock = { 0 };<br>
   auto *Lock = getCriticalRegionLock(".reduction");<br>
@@ -5365,7 +5373,8 @@ static llvm::Value *emitReduceInitFuncti<br>
                                            ReductionCodeGen &RCG, unsigned N) {<br>
   auto &C = CGM.getContext();<br>
   FunctionArgList Args;<br>
-  ImplicitParamDecl Param(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl Param(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, C.VoidPtrTy,<br>
+                          ImplicitParamDecl::Other);<br>
   Args.emplace_back(&Param);<br>
   auto &FnInfo =<br>
       CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, Args);<br>
@@ -5374,8 +5383,7 @@ static llvm::Value *emitReduceInitFuncti<br>
                                     ".red_init.", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, FnInfo);<br>
   CodeGenFunction CGF(CGM);<br>
-  CGF.disableDebugInfo();<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FnInfo, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FnInfo, Args, Loc, Loc);<br>
   Address PrivateAddr = CGF.EmitLoadOfPointer(<br>
       CGF.GetAddrOfLocalVar(&Param),<br>
       C.getPointerType(C.VoidPtrTy).castAs<PointerType>());<br>
@@ -5435,8 +5443,10 @@ static llvm::Value *emitReduceCombFuncti<br>
   auto *LHSVD = cast<VarDecl>(cast<DeclRefExpr>(LHS)->getDecl());<br>
   auto *RHSVD = cast<VarDecl>(cast<DeclRefExpr>(RHS)->getDecl());<br>
   FunctionArgList Args;<br>
-  ImplicitParamDecl ParamInOut(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
-  ImplicitParamDecl ParamIn(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ParamInOut(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                               C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ParamIn(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, C.VoidPtrTy,<br>
+                            ImplicitParamDecl::Other);<br>
   Args.emplace_back(&ParamInOut);<br>
   Args.emplace_back(&ParamIn);<br>
   auto &FnInfo =<br>
@@ -5446,8 +5456,7 @@ static llvm::Value *emitReduceCombFuncti<br>
                                     ".red_comb.", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, FnInfo);<br>
   CodeGenFunction CGF(CGM);<br>
-  CGF.disableDebugInfo();<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FnInfo, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FnInfo, Args, Loc, Loc);<br>
   llvm::Value *Size = nullptr;<br>
   // If the size of the reduction item is non-constant, load it from global<br>
   // threadprivate variable.<br>
@@ -5506,7 +5515,8 @@ static llvm::Value *emitReduceFiniFuncti<br>
     return nullptr;<br>
   auto &C = CGM.getContext();<br>
   FunctionArgList Args;<br>
-  ImplicitParamDecl Param(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl Param(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, C.VoidPtrTy,<br>
+                          ImplicitParamDecl::Other);<br>
   Args.emplace_back(&Param);<br>
   auto &FnInfo =<br>
       CGM.getTypes().arrangeBuiltinFunctionDeclaration(C.VoidTy, Args);<br>
@@ -5515,8 +5525,7 @@ static llvm::Value *emitReduceFiniFuncti<br>
                                     ".red_fini.", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, FnInfo);<br>
   CodeGenFunction CGF(CGM);<br>
-  CGF.disableDebugInfo();<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FnInfo, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, FnInfo, Args, Loc, Loc);<br>
   Address PrivateAddr = CGF.EmitLoadOfPointer(<br>
       CGF.GetAddrOfLocalVar(&Param),<br>
       C.getPointerType(C.VoidPtrTy).castAs<PointerType>());<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h?rev=321816&r1=321815&r2=321816&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h?rev=321816&r1=321815&r2=321816&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h (original)<br>
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h Thu Jan  4 11:45:16 2018<br>
@@ -1048,7 +1048,8 @@ public:<br>
   /// \param RHSExprs List of RHS in \a ReductionOps reduction operations.<br>
   /// \param ReductionOps List of reduction operations in form 'LHS binop RHS'<br>
   /// or 'operator binop(LHS, RHS)'.<br>
-  llvm::Value *emitReductionFunction(CodeGenModule &CGM, llvm::Type *ArgsType,<br>
+  llvm::Value *emitReductionFunction(CodeGenModule &CGM, SourceLocation Loc,<br>
+                                     llvm::Type *ArgsType,<br>
                                      ArrayRef<const Expr *> Privates,<br>
                                      ArrayRef<const Expr *> LHSExprs,<br>
                                      ArrayRef<const Expr *> RHSExprs,<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp?rev=321816&r1=321815&r2=321816&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp?rev=321816&r1=321815&r2=321816&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp Thu Jan  4 11:45:16 2018<br>
@@ -250,8 +250,8 @@ static llvm::Value *getMasterThreadID(Co<br>
 }<br>
<br>
 CGOpenMPRuntimeNVPTX::WorkerFunctionState::WorkerFunctionState(<br>
-    CodeGenModule &CGM)<br>
-    : WorkerFn(nullptr), CGFI(nullptr) {<br>
+    CodeGenModule &CGM, SourceLocation Loc)<br>
+    : WorkerFn(nullptr), CGFI(nullptr), Loc(Loc) {<br>
   createWorkerFunction(CGM);<br>
 }<br>
<br>
@@ -297,28 +297,28 @@ void CGOpenMPRuntimeNVPTX::emitGenericKe<br>
   ExecutionModeRAII ModeRAII(CurrentExecutionMode,<br>
                              CGOpenMPRuntimeNVPTX::ExecutionMode::Generic);<br>
   EntryFunctionState EST;<br>
-  WorkerFunctionState WST(CGM);<br>
+  WorkerFunctionState WST(CGM, D.getLocStart());<br>
   Work.clear();<br>
   WrapperFunctionsMap.clear();<br>
<br>
   // Emit target region as a standalone region.<br>
   class NVPTXPrePostActionTy : public PrePostActionTy {<br>
-    CGOpenMPRuntimeNVPTX &RT;<br>
     CGOpenMPRuntimeNVPTX::EntryFunctionState &EST;<br>
     CGOpenMPRuntimeNVPTX::WorkerFunctionState &WST;<br>
<br>
   public:<br>
-    NVPTXPrePostActionTy(CGOpenMPRuntimeNVPTX &RT,<br>
-                         CGOpenMPRuntimeNVPTX::EntryFunctionState &EST,<br>
+    NVPTXPrePostActionTy(CGOpenMPRuntimeNVPTX::EntryFunctionState &EST,<br>
                          CGOpenMPRuntimeNVPTX::WorkerFunctionState &WST)<br>
-        : RT(RT), EST(EST), WST(WST) {}<br>
+        : EST(EST), WST(WST) {}<br>
     void Enter(CodeGenFunction &CGF) override {<br>
-      RT.emitGenericEntryHeader(CGF, EST, WST);<br>
+      static_cast<CGOpenMPRuntimeNVPTX &>(CGF.CGM.getOpenMPRuntime())<br>
+          .emitGenericEntryHeader(CGF, EST, WST);<br>
     }<br>
     void Exit(CodeGenFunction &CGF) override {<br>
-      RT.emitGenericEntryFooter(CGF, EST);<br>
+      static_cast<CGOpenMPRuntimeNVPTX &>(CGF.CGM.getOpenMPRuntime())<br>
+          .emitGenericEntryFooter(CGF, EST);<br>
     }<br>
-  } Action(*this, EST, WST);<br>
+  } Action(EST, WST);<br>
   CodeGen.setAction(Action);<br>
   emitTargetOutlinedFunctionHelper(D, ParentName, OutlinedFn, OutlinedFnID,<br>
                                    IsOffloadEntry, CodeGen);<br>
@@ -347,7 +347,7 @@ void CGOpenMPRuntimeNVPTX::emitGenericEn<br>
   Bld.CreateCondBr(IsWorker, WorkerBB, MasterCheckBB);<br>
<br>
   CGF.EmitBlock(WorkerBB);<br>
-  emitCall(CGF, WST.WorkerFn);<br>
+  emitOutlinedFunctionCall(CGF, WST.Loc, WST.WorkerFn);<br>
   CGF.EmitBranch(EST.ExitBB);<br>
<br>
   CGF.EmitBlock(MasterCheckBB);<br>
@@ -479,8 +479,8 @@ void CGOpenMPRuntimeNVPTX::emitWorkerFun<br>
   ASTContext &Ctx = CGM.getContext();<br>
<br>
   CodeGenFunction CGF(CGM, /*suppressNewContext=*/true);<br>
-  CGF.disableDebugInfo();<br>
-  CGF.StartFunction(GlobalDecl(), Ctx.VoidTy, WST.WorkerFn, *WST.CGFI, {});<br>
+  CGF.StartFunction(GlobalDecl(), Ctx.VoidTy, WST.WorkerFn, *WST.CGFI, {},<br>
+                    WST.Loc, WST.Loc);<br>
   emitWorkerLoop(CGF, WST);<br>
   CGF.FinishFunction();<br>
 }<br>
@@ -571,8 +571,9 @@ void CGOpenMPRuntimeNVPTX::emitWorkerLoo<br>
     Address Capture = CGF.EmitLoadOfPointer(SharedArgs,<br>
        Ctx.getPointerType(<br>
           Ctx.getPointerType(Ctx.VoidPtrTy)).castAs<PointerType>());<br>
-    emitCall(CGF, W, {Bld.getInt16(/*ParallelLevel=*/0),<br>
-        getMasterThreadID(CGF), Capture.getPointer()});<br>
+    emitOutlinedFunctionCall(CGF, WST.Loc, W,<br>
+                             {Bld.getInt16(/*ParallelLevel=*/0),<br>
+                              getMasterThreadID(CGF), Capture.getPointer()});<br>
<br>
     // Go to end of parallel region.<br>
     CGF.EmitBranch(TerminateBB);<br>
@@ -1319,27 +1320,31 @@ static void emitReductionListCopy(<br>
 ///    local = local @ remote<br>
 ///  else<br>
 ///    local = remote<br>
-static llvm::Value *<br>
-emitReduceScratchpadFunction(CodeGenModule &CGM,<br>
-                             ArrayRef<const Expr *> Privates,<br>
-                             QualType ReductionArrayTy, llvm::Value *ReduceFn) {<br>
+static llvm::Value *emitReduceScratchpadFunction(<br>
+    CodeGenModule &CGM, ArrayRef<const Expr *> Privates,<br>
+    QualType ReductionArrayTy, llvm::Value *ReduceFn, SourceLocation Loc) {<br>
   auto &C = CGM.getContext();<br>
   auto Int32Ty = C.getIntTypeForBitwidth(32, /* Signed */ true);<br>
<br>
   // Destination of the copy.<br>
-  ImplicitParamDecl ReduceListArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ReduceListArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                                  C.VoidPtrTy, ImplicitParamDecl::Other);<br>
   // Base address of the scratchpad array, with each element storing a<br>
   // Reduce list per team.<br>
-  ImplicitParamDecl ScratchPadArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ScratchPadArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                                  C.VoidPtrTy, ImplicitParamDecl::Other);<br>
   // A source index into the scratchpad array.<br>
-  ImplicitParamDecl IndexArg(C, Int32Ty, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl IndexArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, Int32Ty,<br>
+                             ImplicitParamDecl::Other);<br>
   // Row width of an element in the scratchpad array, typically<br>
   // the number of teams.<br>
-  ImplicitParamDecl WidthArg(C, Int32Ty, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl WidthArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, Int32Ty,<br>
+                             ImplicitParamDecl::Other);<br>
   // If should_reduce == 1, then it's load AND reduce,<br>
   // If should_reduce == 0 (or otherwise), then it only loads (+ copy).<br>
   // The latter case is used for initialization.<br>
-  ImplicitParamDecl ShouldReduceArg(C, Int32Ty, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ShouldReduceArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                                    Int32Ty, ImplicitParamDecl::Other);<br>
<br>
   FunctionArgList Args;<br>
   Args.push_back(&ReduceListArg);<br>
@@ -1354,10 +1359,7 @@ emitReduceScratchpadFunction(CodeGenModu<br>
       "_omp_reduction_load_and_reduce", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*DC=*/nullptr, Fn, CGFI);<br>
   CodeGenFunction CGF(CGM);<br>
-  // We don't need debug information in this function as nothing here refers to<br>
-  // user code.<br>
-  CGF.disableDebugInfo();<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args, Loc, Loc);<br>
<br>
   auto &Bld = CGF.Builder;<br>
<br>
@@ -1421,7 +1423,8 @@ emitReduceScratchpadFunction(CodeGenModu<br>
       ReduceListAddr.getPointer(), CGF.VoidPtrTy);<br>
   llvm::Value *RemoteDataPtr = Bld.CreatePointerBitCastOrAddrSpaceCast(<br>
       RemoteReduceList.getPointer(), CGF.VoidPtrTy);<br>
-  CGF.EmitCallOrInvoke(ReduceFn, {LocalDataPtr, RemoteDataPtr});<br>
+  CGM.getOpenMPRuntime().emitOutlinedFunctionCall(<br>
+      CGF, Loc, ReduceFn, {LocalDataPtr, RemoteDataPtr});<br>
   Bld.CreateBr(MergeBB);<br>
<br>
   CGF.EmitBlock(ElseBB);<br>
@@ -1445,22 +1448,27 @@ emitReduceScratchpadFunction(CodeGenModu<br>
 ///<br>
 static llvm::Value *emitCopyToScratchpad(CodeGenModule &CGM,<br>
                                          ArrayRef<const Expr *> Privates,<br>
-                                         QualType ReductionArrayTy) {<br>
+                                         QualType ReductionArrayTy,<br>
+                                         SourceLocation Loc) {<br>
<br>
   auto &C = CGM.getContext();<br>
   auto Int32Ty = C.getIntTypeForBitwidth(32, /* Signed */ true);<br>
<br>
   // Source of the copy.<br>
-  ImplicitParamDecl ReduceListArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ReduceListArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                                  C.VoidPtrTy, ImplicitParamDecl::Other);<br>
   // Base address of the scratchpad array, with each element storing a<br>
   // Reduce list per team.<br>
-  ImplicitParamDecl ScratchPadArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ScratchPadArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                                  C.VoidPtrTy, ImplicitParamDecl::Other);<br>
   // A destination index into the scratchpad array, typically the team<br>
   // identifier.<br>
-  ImplicitParamDecl IndexArg(C, Int32Ty, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl IndexArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, Int32Ty,<br>
+                             ImplicitParamDecl::Other);<br>
   // Row width of an element in the scratchpad array, typically<br>
   // the number of teams.<br>
-  ImplicitParamDecl WidthArg(C, Int32Ty, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl WidthArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, Int32Ty,<br>
+                             ImplicitParamDecl::Other);<br>
<br>
   FunctionArgList Args;<br>
   Args.push_back(&ReduceListArg);<br>
@@ -1474,10 +1482,7 @@ static llvm::Value *emitCopyToScratchpad<br>
       "_omp_reduction_copy_to_scratchpad", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*DC=*/nullptr, Fn, CGFI);<br>
   CodeGenFunction CGF(CGM);<br>
-  // We don't need debug information in this function as nothing here refers to<br>
-  // user code.<br>
-  CGF.disableDebugInfo();<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args, Loc, Loc);<br>
<br>
   auto &Bld = CGF.Builder;<br>
<br>
@@ -1534,17 +1539,19 @@ static llvm::Value *emitCopyToScratchpad<br>
 ///     sync<br>
 static llvm::Value *emitInterWarpCopyFunction(CodeGenModule &CGM,<br>
                                               ArrayRef<const Expr *> Privates,<br>
-                                              QualType ReductionArrayTy) {<br>
+                                              QualType ReductionArrayTy,<br>
+                                              SourceLocation Loc) {<br>
   auto &C = CGM.getContext();<br>
   auto &M = CGM.getModule();<br>
<br>
   // ReduceList: thread local Reduce list.<br>
   // At the stage of the computation when this function is called, partially<br>
   // aggregated values reside in the first lane of every active warp.<br>
-  ImplicitParamDecl ReduceListArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ReduceListArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                                  C.VoidPtrTy, ImplicitParamDecl::Other);<br>
   // NumWarps: number of warps active in the parallel region.  This could<br>
   // be smaller than 32 (max warps in a CTA) for partial block reduction.<br>
-  ImplicitParamDecl NumWarpsArg(C,<br>
+  ImplicitParamDecl NumWarpsArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
                                 C.getIntTypeForBitwidth(32, /* Signed */ true),<br>
                                 ImplicitParamDecl::Other);<br>
   FunctionArgList Args;<br>
@@ -1557,10 +1564,7 @@ static llvm::Value *emitInterWarpCopyFun<br>
       "_omp_reduction_inter_warp_copy_func", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*DC=*/nullptr, Fn, CGFI);<br>
   CodeGenFunction CGF(CGM);<br>
-  // We don't need debug information in this function as nothing here refers to<br>
-  // user code.<br>
-  CGF.disableDebugInfo();<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args, Loc, Loc);<br>
<br>
   auto &Bld = CGF.Builder;<br>
<br>
@@ -1781,21 +1785,23 @@ static llvm::Value *emitInterWarpCopyFun<br>
 ///   (2k+1)th thread is ignored in the value aggregation.  Therefore<br>
 ///   we copy the Reduce list from the (2k+1)th lane to (k+1)th lane so<br>
 ///   that the contiguity assumption still holds.<br>
-static llvm::Value *<br>
-emitShuffleAndReduceFunction(CodeGenModule &CGM,<br>
-                             ArrayRef<const Expr *> Privates,<br>
-                             QualType ReductionArrayTy, llvm::Value *ReduceFn) {<br>
+static llvm::Value *emitShuffleAndReduceFunction(<br>
+    CodeGenModule &CGM, ArrayRef<const Expr *> Privates,<br>
+    QualType ReductionArrayTy, llvm::Value *ReduceFn, SourceLocation Loc) {<br>
   auto &C = CGM.getContext();<br>
<br>
   // Thread local Reduce list used to host the values of data to be reduced.<br>
-  ImplicitParamDecl ReduceListArg(C, C.VoidPtrTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ReduceListArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                                  C.VoidPtrTy, ImplicitParamDecl::Other);<br>
   // Current lane id; could be logical.<br>
-  ImplicitParamDecl LaneIDArg(C, C.ShortTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl LaneIDArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr, C.ShortTy,<br>
+                              ImplicitParamDecl::Other);<br>
   // Offset of the remote source lane relative to the current lane.<br>
-  ImplicitParamDecl RemoteLaneOffsetArg(C, C.ShortTy,<br>
-                                        ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl RemoteLaneOffsetArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                                        C.ShortTy, ImplicitParamDecl::Other);<br>
   // Algorithm version.  This is expected to be known at compile time.<br>
-  ImplicitParamDecl AlgoVerArg(C, C.ShortTy, ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl AlgoVerArg(C, /*DC=*/nullptr, Loc, /*Id=*/nullptr,<br>
+                               C.ShortTy, ImplicitParamDecl::Other);<br>
   FunctionArgList Args;<br>
   Args.push_back(&ReduceListArg);<br>
   Args.push_back(&LaneIDArg);<br>
@@ -1808,10 +1814,7 @@ emitShuffleAndReduceFunction(CodeGenModu<br>
       "_omp_reduction_shuffle_and_reduce_func", &CGM.getModule());<br>
   CGM.SetInternalFunctionAttributes(/*D=*/nullptr, Fn, CGFI);<br>
   CodeGenFunction CGF(CGM);<br>
-  // We don't need debug information in this function as nothing here refers to<br>
-  // user code.<br>
-  CGF.disableDebugInfo();<br>
-  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args);<br>
+  CGF.StartFunction(GlobalDecl(), C.VoidTy, Fn, CGFI, Args, Loc, Loc);<br>
<br>
   auto &Bld = CGF.Builder;<br>
<br>
@@ -1898,7 +1901,8 @@ emitShuffleAndReduceFunction(CodeGenModu<br>
       LocalReduceList.getPointer(), CGF.VoidPtrTy);<br>
   llvm::Value *RemoteReduceListPtr = Bld.CreatePointerBitCastOrAddrSpaceCast(<br>
       RemoteReduceList.getPointer(), CGF.VoidPtrTy);<br>
-  CGF.EmitCallOrInvoke(ReduceFn, {LocalReduceListPtr, RemoteReduceListPtr});<br>
+  CGM.getOpenMPRuntime().emitOutlinedFunctionCall(<br>
+      CGF, Loc, ReduceFn, {LocalReduceListPtr, RemoteReduceListPtr});<br>
   Bld.CreateBr(MergeBB);<br>
<br>
   CGF.EmitBlock(ElseBB);<br>
@@ -2228,8 +2232,8 @@ void CGOpenMPRuntimeNVPTX::emitReduction<br>
<br>
   // 2. Emit reduce_func().<br>
   auto *ReductionFn = emitReductionFunction(<br>
-      CGM, CGF.ConvertTypeForMem(ReductionArrayTy)->getPointerTo(), Privates,<br>
-      LHSExprs, RHSExprs, ReductionOps);<br>
+      CGM, Loc, CGF.ConvertTypeForMem(ReductionArrayTy)->getPointerTo(),<br>
+      Privates, LHSExprs, RHSExprs, ReductionOps);<br>
<br>
   // 4. Build res = __kmpc_reduce{_nowait}(<gtid>, <n>, sizeof(RedList),<br>
   // RedList, shuffle_reduce_func, interwarp_copy_func);<br>
@@ -2239,9 +2243,9 @@ void CGOpenMPRuntimeNVPTX::emitReduction<br>
       ReductionList.getPointer(), CGF.VoidPtrTy);<br>
<br>
   auto *ShuffleAndReduceFn = emitShuffleAndReduceFunction(<br>
-      CGM, Privates, ReductionArrayTy, ReductionFn);<br>
+      CGM, Privates, ReductionArrayTy, ReductionFn, Loc);<br>
   auto *InterWarpCopyFn =<br>
-      emitInterWarpCopyFunction(CGM, Privates, ReductionArrayTy);<br>
+      emitInterWarpCopyFunction(CGM, Privates, ReductionArrayTy, Loc);<br>
<br>
   llvm::Value *Res = nullptr;<br>
   if (ParallelReduction) {<br>
@@ -2259,9 +2263,9 @@ void CGOpenMPRuntimeNVPTX::emitReduction<br>
<br>
   if (TeamsReduction) {<br>
     auto *ScratchPadCopyFn =<br>
-        emitCopyToScratchpad(CGM, Privates, ReductionArrayTy);<br>
+        emitCopyToScratchpad(CGM, Privates, ReductionArrayTy, Loc);<br>
     auto *LoadAndReduceFn = emitReduceScratchpadFunction(<br>
-        CGM, Privates, ReductionArrayTy, ReductionFn);<br>
+        CGM, Privates, ReductionArrayTy, ReductionFn, Loc);<br>
<br>
     llvm::Value *Args[] = {ThreadId,<br>
                            CGF.Builder.getInt32(RHSExprs.size()),<br>
@@ -2422,10 +2426,15 @@ llvm::Function *CGOpenMPRuntimeNVPTX::cr<br>
       Ctx.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/false);<br>
   QualType Int32PtrQTy = Ctx.getPointerType(Int32QTy);<br>
   QualType VoidPtrPtrQTy = Ctx.getPointerType(Ctx.VoidPtrTy);<br>
-  ImplicitParamDecl ParallelLevelArg(Ctx, Int16QTy, ImplicitParamDecl::Other);<br>
-  ImplicitParamDecl WrapperArg(Ctx, Int32QTy, ImplicitParamDecl::Other);<br>
-  ImplicitParamDecl SharedArgsList(Ctx, VoidPtrPtrQTy,<br>
-      ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl ParallelLevelArg(Ctx, /*DC=*/nullptr, D.getLocStart(),<br>
+                                     /*Id=*/nullptr, Int16QTy,<br>
+                                     ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl WrapperArg(Ctx, /*DC=*/nullptr, D.getLocStart(),<br>
+                               /*Id=*/nullptr, Int32QTy,<br>
+                               ImplicitParamDecl::Other);<br>
+  ImplicitParamDecl SharedArgsList(Ctx, /*DC=*/nullptr, D.getLocStart(),<br>
+                                   /*Id=*/nullptr, VoidPtrPtrQTy,<br>
+                                   ImplicitParamDecl::Other);<br>
   WrapperArgs.emplace_back(&ParallelLevelArg);<br>
   WrapperArgs.emplace_back(&WrapperArg);<br>
   WrapperArgs.emplace_back(&SharedArgsList);<br>
@@ -2440,7 +2449,8 @@ llvm::Function *CGOpenMPRuntimeNVPTX::cr<br>
   Fn->setLinkage(llvm::GlobalValue::InternalLinkage);<br>
<br>
   CodeGenFunction CGF(CGM, /*suppressNewContext=*/true);<br>
-  CGF.StartFunction(GlobalDecl(), Ctx.VoidTy, Fn, CGFI, WrapperArgs);<br>
+  CGF.StartFunction(GlobalDecl(), Ctx.VoidTy, Fn, CGFI, WrapperArgs,<br>
+                    D.getLocStart(), D.getLocStart());<br>
<br>
   const auto *RD = CS.getCapturedRecordDecl();<br>
   auto CurField = RD->field_begin();<br>
@@ -2489,7 +2499,7 @@ llvm::Function *CGOpenMPRuntimeNVPTX::cr<br>
     Args.emplace_back(Arg);<br>
   }<br>
<br>
-  emitCall(CGF, OutlinedParallelFn, Args);<br>
+  emitOutlinedFunctionCall(CGF, D.getLocStart(), OutlinedParallelFn, Args);<br>
   CGF.FinishFunction();<br>
   return Fn;<br>
 }<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.h?rev=321816&r1=321815&r2=321816&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.h?rev=321816&r1=321815&r2=321816&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.h (original)<br>
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.h Thu Jan  4 11:45:16 2018<br>
@@ -36,8 +36,9 @@ private:<br>
   public:<br>
     llvm::Function *WorkerFn;<br>
     const CGFunctionInfo *CGFI;<br>
+    SourceLocation Loc;<br>
<br>
-    WorkerFunctionState(CodeGenModule &CGM);<br>
+    WorkerFunctionState(CodeGenModule &CGM, SourceLocation Loc);<br>
<br>
   private:<br>
     void createWorkerFunction(CodeGenModule &CGM);<br>
<br>
Modified: cfe/trunk/test/OpenMP/target_parallel_debug_codegen.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_debug_codegen.cpp?rev=321816&r1=321815&r2=321816&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_debug_codegen.cpp?rev=321816&r1=321815&r2=321816&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/OpenMP/target_parallel_debug_codegen.cpp (original)<br>
+++ cfe/trunk/test/OpenMP/target_parallel_debug_codegen.cpp Thu Jan  4 11:45:16 2018<br>
@@ -116,8 +116,8 @@ int main() {<br>
 // CHECK: !DILocalVariable(name: ".bound_tid.",<br>
 // CHECK-SAME: DIFlagArtificial<br>
 // CHECK: !DILocalVariable(name: "c",<br>
-// CHECK-SAMEi-NOT: DIFlagArtificial<br>
+// CHECK-SAME: line: 11<br>
 // CHECK: !DILocalVariable(name: "a",<br>
-// CHECK-SAMEi-NOT: DIFlagArtificial<br>
+// CHECK-SAME: line: 9<br>
 // CHECK: !DILocalVariable(name: "b",<br>
-// CHECK-SAMEi-NOT: DIFlagArtificial<br>
+// CHECK-SAME: line: 10<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>