From bf1aff02c12b10cae2f6ad3b959ba84f78cb0b5b Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Mon, 14 Aug 2017 16:03:47 +0000 Subject: [PATCH] [OPENMP][DEBUG] Fix for PR33676: Debug info for OpenMP region is broken. After some changes in clang/LLVM debug info for task-based regions was not generated at all. Patch fixes this problem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310850 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGOpenMPRuntime.cpp | 1 - lib/CodeGen/CGStmtOpenMP.cpp | 4 ++-- test/OpenMP/taskloop_reduction_codegen.cpp | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp index afbeb183e8..8856aafae9 100644 --- a/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/lib/CodeGen/CGOpenMPRuntime.cpp @@ -3790,7 +3790,6 @@ emitProxyTaskFunction(CodeGenModule &CGM, SourceLocation Loc, ".omp_task_entry.", &CGM.getModule()); CGM.SetInternalFunctionAttributes(/*D=*/nullptr, TaskEntry, TaskEntryFnInfo); CodeGenFunction CGF(CGM); - CGF.disableDebugInfo(); CGF.StartFunction(GlobalDecl(), KmpInt32Ty, TaskEntry, TaskEntryFnInfo, Args); // TaskFunction(gtid, tt->task_data.part_id, &tt->privates, task_privates_map, diff --git a/lib/CodeGen/CGStmtOpenMP.cpp b/lib/CodeGen/CGStmtOpenMP.cpp index c7e74b2c57..eccf1ecff0 100644 --- a/lib/CodeGen/CGStmtOpenMP.cpp +++ b/lib/CodeGen/CGStmtOpenMP.cpp @@ -342,8 +342,8 @@ static llvm::Function *emitOutlinedFunctionPrologue( F->setDoesNotThrow(); // Generate the function. - CGF.StartFunction(CD, Ctx.VoidTy, F, FuncInfo, TargetArgs, CD->getLocation(), - CD->getBody()->getLocStart()); + CGF.StartFunction(CD, Ctx.VoidTy, F, FuncInfo, TargetArgs, + FO.S->getLocStart(), CD->getBody()->getLocStart()); unsigned Cnt = CD->getContextParamPosition(); I = FO.S->captures().begin(); for (auto *FD : RD->fields()) { diff --git a/test/OpenMP/taskloop_reduction_codegen.cpp b/test/OpenMP/taskloop_reduction_codegen.cpp index af071ae8bd..10cbf97163 100644 --- a/test/OpenMP/taskloop_reduction_codegen.cpp +++ b/test/OpenMP/taskloop_reduction_codegen.cpp @@ -143,7 +143,7 @@ sum = 0.0; // CHECK: [[DIV:%.*]] = sdiv i32 [[ADD11]], 1 // CHECK: [[SUB12:%.*]] = sub nsw i32 [[DIV]], 1 // CHECK: store i32 [[SUB12]], i32* [[DOTCAPTURE_EXPR_9]], -// CHECK: [[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%ident_t* %{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 72, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @{{.+}} to i32 (i32, i8*)*)) +// CHECK: [[TMP65:%.*]] = call i8* @__kmpc_omp_task_alloc(%ident_t* %{{.+}}, i32 [[TMP0]], i32 1, i64 888, i64 72, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @[[TASK:.+]] to i32 (i32, i8*)*)) // CHECK: call void @__kmpc_taskloop(%ident_t* %{{.+}}, i32 [[TMP0]], i8* [[TMP65]], i32 1, i64* %{{.+}}, i64* %{{.+}}, i64 %{{.+}}, i32 0, i32 0, i64 0, i8* null) // CHECK: call void @__kmpc_end_taskgroup(%ident_t* @@ -195,3 +195,4 @@ sum = 0.0; // CHECK: store float %{{.+}}, float* % // CHECK: ret void +// CHECK: distinct !DISubprogram(linkageName: "[[TASK]]", scope: ! -- 2.40.0