Skip to content

Commit f8c83de

Browse files
authored
[Clang][OpenMP] Process debug info for reduction - fix SWDEV-535727 (llvm#2748)
2 parents 67a3e1c + cb30313 commit f8c83de

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
@@ -9720,6 +9720,17 @@ static void emitTargetCallKernelLaunch(
97209720
++RedVarCount;
97219721
}
97229722
}
9723+
// Process debug info.
9724+
if (CGF.CGM.getCodeGenOpts().getDebugInfo() !=
9725+
llvm::codegenoptions::NoDebugInfo) {
9726+
auto FillInfoMap = [&](MappableExprsHandler::MappingExprInfo &MapExpr) {
9727+
return emitMappingInformation(CGF, OMPBuilder, MapExpr);
9728+
};
9729+
9730+
CombinedInfo.Names.resize(CombinedInfo.Exprs.size());
9731+
llvm::transform(CombinedInfo.Exprs, CombinedInfo.Names.begin(),
9732+
FillInfoMap);
9733+
}
97239734
}
97249735

97259736
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)