[clang] 62d0b71 - [OMPIRBuilder] Avoid invalid debug location. (#153190)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 12 08:20:56 PDT 2025
Author: Abid Qadeer
Date: 2025-08-12T16:20:52+01:00
New Revision: 62d0b712b76b2f6c8e734cd75be50120ff465f24
URL: https://github.com/llvm/llvm-project/commit/62d0b712b76b2f6c8e734cd75be50120ff465f24
DIFF: https://github.com/llvm/llvm-project/commit/62d0b712b76b2f6c8e734cd75be50120ff465f24.diff
LOG: [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.
Added:
clang/test/OpenMP/amdgcn_debug_nowait.c
Modified:
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
Removed:
################################################################################
diff --git a/clang/test/OpenMP/amdgcn_debug_nowait.c b/clang/test/OpenMP/amdgcn_debug_nowait.c
new file mode 100644
index 0000000000000..d691327512ff7
--- /dev/null
+++ b/clang/test/OpenMP/amdgcn_debug_nowait.c
@@ -0,0 +1,16 @@
+// REQUIRES: amdgpu-registered-target
+
+// 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
+
+int test() {
+ int c;
+
+#pragma omp target data map(tofrom: c)
+{
+ #pragma omp target nowait
+ {
+ c = 2;
+ }
+}
+ return c;
+}
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index 2ac9a0d3fbd66..c16b0dde1a3da 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -7247,7 +7247,7 @@ OpenMPIRBuilder::InsertPointOrErrorTy OpenMPIRBuilder::createTargetData(
BodyGenCB(Builder.saveIP(), BodyGenTy::NoPriv);
if (!AfterIP)
return AfterIP.takeError();
- Builder.restoreIP(*AfterIP);
+ restoreIPandDebugLoc(Builder, *AfterIP);
if (IfCond)
return emitIfClause(IfCond, EndThenGen, EndElseGen, AllocaIP);
More information about the cfe-commits
mailing list