[libclc] r279692 - Strip opencl.ocl.version metadata

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 24 17:25:11 PDT 2016


Author: arsenm
Date: Wed Aug 24 19:25:10 2016
New Revision: 279692

URL: http://llvm.org/viewvc/llvm-project?rev=279692&view=rev
Log:
Strip opencl.ocl.version metadata

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.

Modified:
    libclc/trunk/utils/prepare-builtins.cpp

Modified: libclc/trunk/utils/prepare-builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/utils/prepare-builtins.cpp?rev=279692&r1=279691&r2=279692&view=diff
==============================================================================
--- libclc/trunk/utils/prepare-builtins.cpp (original)
+++ libclc/trunk/utils/prepare-builtins.cpp Wed Aug 24 19:25:10 2016
@@ -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)




More information about the cfe-commits mailing list