[Openmp-commits] [PATCH] D122550: [NVPTX] Allow degenerated `nvvm.annotations`
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Sun Mar 27 15:18:12 PDT 2022
jdoerfert created this revision.
jdoerfert added reviewers: tra, kovdan01, jhuber6.
Herald added subscribers: asavonic, bollu, hiraditya, jholewinski.
Herald added a project: All.
jdoerfert requested review of this revision.
Herald added a subscriber: sstefan1.
Herald added a project: LLVM.
As part of D120129 <https://reviews.llvm.org/D120129> we started to assert if an `nvvm.annotation` had a
nullptr as a first component. That is however happening with OpenMP
offload and older CUDA versions, e.g., CUDA 11.0.2, while newer ones,
e.g., 11.4.0 work fine. There is no need to require a non-null value
so let's keep things working for old codes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122550
Files:
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
llvm/test/CodeGen/NVPTX/param-vectorize-device.ll
Index: llvm/test/CodeGen/NVPTX/param-vectorize-device.ll
===================================================================
--- llvm/test/CodeGen/NVPTX/param-vectorize-device.ll
+++ llvm/test/CodeGen/NVPTX/param-vectorize-device.ll
@@ -799,3 +799,7 @@
%oldret = insertvalue [4 x i32] %7, i32 %4, 3
ret [4 x i32] %oldret
}
+
+!nvvm.annotations = !{!0}
+
+!0 = !{null, !"foobar", i32 0}
Index: llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
===================================================================
--- llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -4273,6 +4273,11 @@
assert(MDN->getNumOperands() == 3);
const Metadata *MD0 = MDN->getOperand(0).get();
+ // Allow degenerated annotations created by OpenMP offloading with old
+ // CUDA versions.
+ if (!MD0)
+ continue;
+
const auto *MDV0 = cast<ConstantAsMetadata>(MD0)->getValue();
const auto *MDFn = cast<Function>(MDV0);
if (MDFn != F)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122550.418472.patch
Type: text/x-patch
Size: 1029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220327/8f85ba9a/attachment.bin>
More information about the Openmp-commits
mailing list