Skip to content

Commit c7acac6

Browse files
committed
[Clang][OpenMP] Process debug info for reduction - fix SWDEV-535727
This PR fixes the issue report in SWDEV-535727. Added logic to process debug info for reduction pragma.
1 parent 4e544f4 commit c7acac6

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9994,6 +9994,17 @@ static void emitTargetCallKernelLaunch(
99949994
++RedVarCount;
99959995
}
99969996
}
9997+
// Process debug info.
9998+
if (CGF.CGM.getCodeGenOpts().getDebugInfo() !=
9999+
llvm::codegenoptions::NoDebugInfo) {
10000+
auto FillInfoMap = [&](MappableExprsHandler::MappingExprInfo &MapExpr) {
10001+
return emitMappingInformation(CGF, OMPBuilder, MapExpr);
10002+
};
10003+
10004+
CombinedInfo.Names.resize(CombinedInfo.Exprs.size());
10005+
llvm::transform(CombinedInfo.Exprs, CombinedInfo.Names.begin(),
10006+
FillInfoMap);
10007+
}
999710008
}
999810009

999910010
CGOpenMPRuntime::TargetDataInfo Info;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %clang -g %s -fopenmp --offload-arch=gfx90a -S --offload-host-only -emit-llvm -o - | FileCheck %s
2+
3+
void test_xteam_red_debug_info() {
4+
int N = 100000;
5+
double c[N];
6+
double sum = 0.0;
7+
#pragma omp target teams distribute parallel for reduction(+: sum)
8+
for (int i=0; i<N; i++){
9+
sum += c[i];
10+
}
11+
sum = sum/(double)N;
12+
}
13+
14+
// CHECK: @.offload_sizes = private unnamed_addr constant [6 x i64]
15+
// CHECK-NEXT: @.offload_maptypes = private unnamed_addr constant [6 x i64]
16+
// CHECK-NEXT: @.offload_mapnames = private constant [6 x ptr]

0 commit comments

Comments
 (0)