[PATCH] D139595: [OpenMP][FIX] Remove AssertingVHs that outlive their values
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 7 17:46:04 PST 2022
jdoerfert created this revision.
jdoerfert added reviewers: jhuber6, jsjodin, ABataev.
Herald added subscribers: guansong, bollu, yaxunl.
Herald added a project: All.
jdoerfert requested review of this revision.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a project: LLVM.
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.
https://reviews.llvm.org/D139595
Files:
clang/test/OpenMP/target_codegen_ref_assertion_vh.cpp
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
Index: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
===================================================================
--- llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
+++ llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
@@ -1077,7 +1077,7 @@
/// <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,
Index: clang/test/OpenMP/target_codegen_ref_assertion_vh.cpp
===================================================================
--- /dev/null
+++ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139595.481122.patch
Type: text/x-patch
Size: 1527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221208/100d79f1/attachment.bin>
More information about the llvm-commits
mailing list