[llvm] a87de3a - OpenMPOpt: Fix introducing empty nvvm.annotations into module
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 3 07:32:16 PST 2023
Author: Matt Arsenault
Date: 2023-01-03T10:32:10-05:00
New Revision: a87de3a6dc73abf90802e95c15e68ac27a3bafe1
URL: https://github.com/llvm/llvm-project/commit/a87de3a6dc73abf90802e95c15e68ac27a3bafe1
DIFF: https://github.com/llvm/llvm-project/commit/a87de3a6dc73abf90802e95c15e68ac27a3bafe1.diff
LOG: OpenMPOpt: Fix introducing empty nvvm.annotations into module
Added:
llvm/test/Transforms/OpenMP/no-insert-nvvm-annotations.ll
Modified:
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index f78422ff7d7d8..f752ff818cf06 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -5122,7 +5122,7 @@ PreservedAnalyses OpenMPOptCGSCCPass::run(LazyCallGraph::SCC &C,
KernelSet llvm::omp::getDeviceKernels(Module &M) {
// TODO: Create a more cross-platform way of determining device kernels.
- NamedMDNode *MD = M.getOrInsertNamedMetadata("nvvm.annotations");
+ NamedMDNode *MD = M.getNamedMetadata("nvvm.annotations");
KernelSet Kernels;
if (!MD)
diff --git a/llvm/test/Transforms/OpenMP/no-insert-nvvm-annotations.ll b/llvm/test/Transforms/OpenMP/no-insert-nvvm-annotations.ll
new file mode 100644
index 0000000000000..62d8e1e53a2d3
--- /dev/null
+++ b/llvm/test/Transforms/OpenMP/no-insert-nvvm-annotations.ll
@@ -0,0 +1,12 @@
+; RUN: opt -S -passes=openmp-opt < %s | FileCheck %s
+; Make sure nvvm.annotations isn't introduced into the module
+
+; CHECK-NOT: nvvm
+
+define amdgpu_kernel void @foo() {
+ ret void
+}
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 7, !"openmp", i32 50}
More information about the llvm-commits
mailing list