[Libclc-dev] [PATCH] Strip opencl.ocl.version metadata

via Libclc-dev libclc-dev at lists.llvm.org
Wed Aug 24 12:52:57 PDT 2016


From: Matt Arsenault <arsenm2 at gmail.com>

This should be uniqued when linking, but right now it creates
a lot of metadata spam listing the same version. This should also
probably be reporting the compiled version of the user program,
which may differ from the library. Currently the library IR files report
1.0 while 1.1/1.2 are the default for user programs.
---
 utils/prepare-builtins.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/utils/prepare-builtins.cpp b/utils/prepare-builtins.cpp
index 3122f48..8870672 100644
--- a/utils/prepare-builtins.cpp
+++ b/utils/prepare-builtins.cpp
@@ -57,6 +57,13 @@ int main(int argc, char **argv) {
     return 1;
   }
 
+  // Strip the OpenCL version metadata. There are a lot of linked
+  // modules in the library build, each spamming the same
+  // version. This may also report a different version than the user
+  // program is using. This should probably be uniqued when linking.
+  if (NamedMDNode *OCLVersion = M->getNamedMetadata("opencl.ocl.version"))
+      M->eraseNamedMetadata(OCLVersion);
+
   // Set linkage of every external definition to linkonce_odr.
   for (Module::iterator i = M->begin(), e = M->end(); i != e; ++i) {
     if (!i->isDeclaration() && i->getLinkage() == GlobalValue::ExternalLinkage)
-- 
2.9.2



More information about the Libclc-dev mailing list