[llvm] 6133942 - [OpenMP][FIX] Remove AssertingVHs that outlive their values
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 7 18:28:42 PST 2022
Author: Johannes Doerfert
Date: 2022-12-07T18:27:55-08:00
New Revision: 61339427961a4399174e3e69240de7d1ad403046
URL: https://github.com/llvm/llvm-project/commit/61339427961a4399174e3e69240de7d1ad403046
DIFF: https://github.com/llvm/llvm-project/commit/61339427961a4399174e3e69240de7d1ad403046.diff
LOG: [OpenMP][FIX] Remove AssertingVHs that outlive their values
The map with AssertingVHs has been moved into the OpenMPIRBuilder which extended their lifetime.
On NVIDIA this will cause an assertion. This simply removes the AssertingVH wrapper.
Added:
clang/test/OpenMP/target_codegen_ref_assertion_vh.cpp
Modified:
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
Removed:
################################################################################
diff --git a/clang/test/OpenMP/target_codegen_ref_assertion_vh.cpp b/clang/test/OpenMP/target_codegen_ref_assertion_vh.cpp
new file mode 100644
index 0000000000000..7fb2bbfda7d14
--- /dev/null
+++ b/clang/test/OpenMP/target_codegen_ref_assertion_vh.cpp
@@ -0,0 +1,11 @@
+// REQUIRES: nvptx-registered-target
+//
+// Test target codegen - host bc file has to be created first.
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o %t.final
+// expected-no-diagnostics
+
+#pragma omp begin declare target
+constexpr int A[] = {1,2,3,4,5};
+int f(int i) { return A[i]; }
+#pragma omp end declare target
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
index e0951470bc66f..f029e32e85f95 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -1077,7 +1077,7 @@ class OpenMPIRBuilder {
/// <critical_section_name> + ".var" for "omp critical" directives; 2)
/// <mangled_name_for_global_var> + ".cache." for cache for threadprivate
/// variables.
- StringMap<AssertingVH<Constant>, BumpPtrAllocator> InternalVars;
+ StringMap<Constant*, BumpPtrAllocator> InternalVars;
/// Create the global variable holding the offload mappings information.
GlobalVariable *createOffloadMaptypes(SmallVectorImpl<uint64_t> &Mappings,
More information about the llvm-commits
mailing list