From: Alexey Bataev Date: Wed, 25 Oct 2017 15:54:04 +0000 (+0000) Subject: [OPENMP] Improve debug info for taskgroup implicitly generated X-Git-Tag: llvmorg-6.0.0-rc1~4912 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d070a585f617a2d37d24c6fcf31f2323f7dcc296;p=platform%2Fupstream%2Fllvm.git [OPENMP] Improve debug info for taskgroup implicitly generated expressions. llvm-svn: 316585 --- diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 82e7967..941ac75 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -835,10 +835,10 @@ void DSAStackTy::addTaskgroupReductionData(ValueDecl *D, SourceRange SR, Expr *&TaskgroupReductionRef = Stack.back().first.back().TaskgroupReductionRef; if (!TaskgroupReductionRef) { - auto *VD = buildVarDecl(SemaRef, SourceLocation(), + auto *VD = buildVarDecl(SemaRef, SR.getBegin(), SemaRef.Context.VoidPtrTy, ".task_red."); - TaskgroupReductionRef = buildDeclRefExpr( - SemaRef, VD, SemaRef.Context.VoidPtrTy, SourceLocation()); + TaskgroupReductionRef = + buildDeclRefExpr(SemaRef, VD, SemaRef.Context.VoidPtrTy, SR.getBegin()); } } @@ -858,10 +858,10 @@ void DSAStackTy::addTaskgroupReductionData(ValueDecl *D, SourceRange SR, Expr *&TaskgroupReductionRef = Stack.back().first.back().TaskgroupReductionRef; if (!TaskgroupReductionRef) { - auto *VD = buildVarDecl(SemaRef, SourceLocation(), - SemaRef.Context.VoidPtrTy, ".task_red."); - TaskgroupReductionRef = buildDeclRefExpr( - SemaRef, VD, SemaRef.Context.VoidPtrTy, SourceLocation()); + auto *VD = buildVarDecl(SemaRef, SR.getBegin(), SemaRef.Context.VoidPtrTy, + ".task_red."); + TaskgroupReductionRef = + buildDeclRefExpr(SemaRef, VD, SemaRef.Context.VoidPtrTy, SR.getBegin()); } } @@ -9720,8 +9720,7 @@ static bool ActOnOMPReductionKindClause( // (type of the variable or single array element). PrivateTy = Context.getVariableArrayType( Type, - new (Context) OpaqueValueExpr(SourceLocation(), Context.getSizeType(), - VK_RValue), + new (Context) OpaqueValueExpr(ELoc, Context.getSizeType(), VK_RValue), ArrayType::Normal, /*IndexTypeQuals=*/0, SourceRange()); } else if (!ASE && !OASE && Context.getAsArrayType(D->getType().getNonReferenceType())) @@ -9803,8 +9802,7 @@ static bool ActOnOMPReductionKindClause( if (Type->isPointerType()) { // Cast to pointer type. auto CastExpr = S.BuildCStyleCastExpr( - SourceLocation(), Context.getTrivialTypeSourceInfo(Type, ELoc), - SourceLocation(), Init); + ELoc, Context.getTrivialTypeSourceInfo(Type, ELoc), ELoc, Init); if (CastExpr.isInvalid()) continue; Init = CastExpr.get(); @@ -9898,9 +9896,9 @@ static bool ActOnOMPReductionKindClause( S.BuildBinOp(Stack->getCurScope(), ReductionId.getLocStart(), BO_Assign, LHSDRE, ReductionOp.get()); } else { - auto *ConditionalOp = new (Context) ConditionalOperator( - ReductionOp.get(), SourceLocation(), LHSDRE, SourceLocation(), - RHSDRE, Type, VK_LValue, OK_Ordinary); + auto *ConditionalOp = new (Context) + ConditionalOperator(ReductionOp.get(), ELoc, LHSDRE, ELoc, RHSDRE, + Type, VK_LValue, OK_Ordinary); ReductionOp = S.BuildBinOp(Stack->getCurScope(), ReductionId.getLocStart(), BO_Assign, LHSDRE, ConditionalOp); @@ -10782,7 +10780,7 @@ Sema::ActOnOpenMPDependClause(OpenMPDependClauseKind DepKind, } bool Suppress = getDiagnostics().getSuppressAllDiagnostics(); getDiagnostics().setSuppressAllDiagnostics(/*Val=*/true); - ExprResult Res = CreateBuiltinUnaryOp(SourceLocation(), UO_AddrOf, + ExprResult Res = CreateBuiltinUnaryOp(ELoc, UO_AddrOf, RefExpr->IgnoreParenImpCasts()); getDiagnostics().setSuppressAllDiagnostics(Suppress); if (!Res.isUsable() && !isa(SimpleExpr)) { diff --git a/clang/test/OpenMP/taskgroup_task_reduction_codegen.cpp b/clang/test/OpenMP/taskgroup_task_reduction_codegen.cpp index 884d002..63e0151 100644 --- a/clang/test/OpenMP/taskgroup_task_reduction_codegen.cpp +++ b/clang/test/OpenMP/taskgroup_task_reduction_codegen.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -x c++ -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ %s -verify -debug-info-kind=limited -emit-llvm -o - -triple x86_64-apple-darwin10 | FileCheck %s --check-prefix=CHECK --check-prefix=DEBUG // expected-no-diagnostics #ifndef HEADER #define HEADER @@ -34,7 +35,7 @@ int main(int argc, char **argv) { // CHECK: [[A:%.+]] = alloca i32, // CHECK: [[B:%.+]] = alloca float, // CHECK: [[C:%.+]] = alloca [5 x %struct.S], -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%ident_t* @0) +// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%ident_t* // CHECK: [[RD_IN1:%.+]] = alloca [3 x [[T1:%[^,]+]]], // CHECK: [[TD1:%.+]] = alloca i8*, // CHECK: [[RD_IN2:%.+]] = alloca [2 x [[T2:%[^,]+]]], @@ -42,7 +43,7 @@ int main(int argc, char **argv) { // CHECK: [[VLA:%.+]] = alloca i16, i64 [[VLA_SIZE:%[^,]+]], -// CHECK: call void @__kmpc_taskgroup(%ident_t* @0, i32 [[GTID]]) +// CHECK: call void @__kmpc_taskgroup(%ident_t* {{[^,]+}}, i32 [[GTID]]) // CHECK-DAG: [[BC_A:%.+]] = bitcast i32* [[A]] to i8* // CHECK-DAG: store i8* [[BC_A]], i8** [[A_REF:[^,]+]], // CHECK-DAG: [[A_REF]] = getelementptr inbounds [[T1]], [[T1]]* [[GEPA:%[^,]+]], i32 0, i32 0 @@ -90,8 +91,9 @@ int main(int argc, char **argv) { // CHECK-DAG: call void @llvm.memset.p0i8.i64(i8* [[TMP27]], i8 0, i64 4, i32 8, i1 false) // CHECK-DAG: [[TMP28:%.+]] = bitcast [3 x [[T1]]]* [[RD_IN1]] to i8* // CHECK-DAG: [[TMP29:%.+]] = call i8* @__kmpc_task_reduction_init(i32 [[GTID]], i32 3, i8* [[TMP28]]) +// DEBUG-DAG: call void @llvm.dbg.declare(metadata i8** [[TD1]], // CHECK-DAG: store i8* [[TMP29]], i8** [[TD1]], -// CHECK-DAG: call void @__kmpc_taskgroup(%ident_t* @0, i32 [[GTID]]) +// CHECK-DAG: call void @__kmpc_taskgroup(%ident_t* {{[^,]+}}, i32 [[GTID]]) // CHECK-DAG: [[TMP31:%.+]] = bitcast [5 x %struct.S]* [[C]] to i8* // CHECK-DAG: store i8* [[TMP31]], i8** [[TMP30:%[^,]+]], // CHECK-DAG: [[TMP30]] = getelementptr inbounds [[T2]], [[T2]]* [[GEPC:%[^,]+]], i32 0, i32 0 @@ -126,8 +128,8 @@ int main(int argc, char **argv) { // CHECK: [[TMP47:%.+]] = bitcast [2 x [[T2]]]* [[RD_IN2]] to i8* // CHECK: [[TMP48:%.+]] = call i8* @__kmpc_task_reduction_init(i32 [[GTID]], i32 2, i8* [[TMP47]]) // CHECK: store i8* [[TMP48]], i8** [[TD2]], -// CHECK: call void @__kmpc_end_taskgroup(%ident_t* @0, i32 [[GTID]]) -// CHECK: call void @__kmpc_end_taskgroup(%ident_t* @0, i32 [[GTID]]) +// CHECK: call void @__kmpc_end_taskgroup(%ident_t* {{[^,]+}}, i32 [[GTID]]) +// CHECK: call void @__kmpc_end_taskgroup(%ident_t* {{[^,]+}}, i32 [[GTID]]) // CHECK-DAG: define internal void [[AINIT]](i8*) // CHECK-DAG: store i32 0, i32* % @@ -187,8 +189,8 @@ int main(int argc, char **argv) { // CHECK_DAG: } // CHECK-DAG: define internal void [[VLAINIT]](i8*) -// CHECK-DAG: call i32 @__kmpc_global_thread_num(%ident_t* @0) -// CHECK-DAG: call i8* @__kmpc_threadprivate_cached(%ident_t* @0, i32 % +// CHECK-DAG: call i32 @__kmpc_global_thread_num(%ident_t* {{[^,]+}}) +// CHECK-DAG: call i8* @__kmpc_threadprivate_cached(%ident_t* // CHECK-DAG: phi i16* [ // CHECK-DAG: store i16 0, i16* % // CHECK-DAG: br i1 % @@ -196,8 +198,8 @@ int main(int argc, char **argv) { // CHECK-DAG: } // CHECK-DAG: define internal void [[VLACOMB]](i8*, i8*) -// CHECK-DAG: call i32 @__kmpc_global_thread_num(%ident_t* @0) -// CHECK-DAG: call i8* @__kmpc_threadprivate_cached(%ident_t* @0, i32 % +// CHECK-DAG: call i32 @__kmpc_global_thread_num(%ident_t* {{[^,]+}}) +// CHECK-DAG: call i8* @__kmpc_threadprivate_cached(%ident_t* // CHECK-DAG: phi i16* [ // CHECK-DAG: phi i16* [ // CHECK-DAG: sext i16 %{{.+}} to i32