Skip to content

Commit 62d0b71

Browse files
authored
[OMPIRBuilder] Avoid invalid debug location. (#153190)
Fixes #153043. This is another case of debug location not getting updated when the insert point is changed by the `restoreIP`. Fixed by using the wrapper function that updates the debug location.
1 parent 8c5e939 commit 62d0b71

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// REQUIRES: amdgpu-registered-target
2+
3+
// RUN: %clang_cc1 -debug-info-kind=line-tables-only -fopenmp -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-host.bc
4+
5+
int test() {
6+
int c;
7+
8+
#pragma omp target data map(tofrom: c)
9+
{
10+
#pragma omp target nowait
11+
{
12+
c = 2;
13+
}
14+
}
15+
return c;
16+
}

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7247,7 +7247,7 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createTargetData(
72477247
BodyGenCB(Builder.saveIP(), BodyGenTy::NoPriv);
72487248
if (!AfterIP)
72497249
return AfterIP.takeError();
7250-
Builder.restoreIP(*AfterIP);
7250+
restoreIPandDebugLoc(Builder, *AfterIP);
72517251

72527252
if (IfCond)
72537253
return emitIfClause(IfCond, EndThenGen, EndElseGen, AllocaIP);

0 commit comments

Comments
 (0)