-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[OMPIRBuilder] Avoid invalid debug location. #153190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes llvm#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.
|
@llvm/pr-subscribers-flang-openmp Author: Abid Qadeer (abidh) ChangesFixes #153043. This is another case of debug location not getting updated when the insert point is changed by the Full diff: https://github.com/llvm/llvm-project/pull/153190.diff 2 Files Affected:
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);
|
|
@llvm/pr-subscribers-clang Author: Abid Qadeer (abidh) ChangesFixes #153043. This is another case of debug location not getting updated when the insert point is changed by the Full diff: https://github.com/llvm/llvm-project/pull/153190.diff 2 Files Affected:
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);
|
TIFitis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Nit: Is there any existing test file we can add this to instead of creating a new one? Otherwise I'm okay.
|
Should we replace all |
Currently I have been doing it in selective cases. But I think we should do the change en-masse to better future proof us. I will work on it after this PR. Please note that there are 2 different code patterns we need to handle (More details in the description of the #151306). All the occurrences of the 2nd pattern need this change. |
Thanks for the prompt review. I looked at the existing testcases and did not see any that fits this exact pattern. |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/22483 Here is the relevant piece of the build log for the reference |
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.