Skip to content

Instantly share code, notes, and snippets.

@mazhe
Created January 24, 2017 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazhe/e094ac71ae25d40d46fd49510311204e to your computer and use it in GitHub Desktop.
Save mazhe/e094ac71ae25d40d46fd49510311204e to your computer and use it in GitHub Desktop.
Index: graphics/libGL/Makefile.common
===================================================================
--- graphics/libGL/Makefile.common (revision 432154)
+++ graphics/libGL/Makefile.common (working copy)
@@ -62,7 +62,7 @@
COMPONENT= ${PORTNAME:tl:C/^lib//:C/mesa-//}
-MESA_LLVM_VER=37
+MESA_LLVM_VER=39
CONFIGURE_ARGS+= --with-sha1=libcrypto
Index: graphics/libGL/files/patch-src__gallium__state_trackers__clover__llvm__invocation.cpp
===================================================================
--- graphics/libGL/files/patch-src__gallium__state_trackers__clover__llvm__invocation.cpp (nonexistent)
+++ graphics/libGL/files/patch-src__gallium__state_trackers__clover__llvm__invocation.cpp (working copy)
@@ -0,0 +1,46 @@
+--- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig 2017-01-21 12:22:16.618767000 +0000
++++ src/gallium/state_trackers/clover/llvm/invocation.cpp 2017-01-21 12:31:57.563277000 +0000
+@@ -206,6 +206,9 @@
+ // http://www.llvm.org/bugs/show_bug.cgi?id=19735
+ c.getDiagnosticOpts().ShowCarets = false;
+ c.getInvocation().setLangDefaults(c.getLangOpts(), clang::IK_OpenCL,
++#if HAVE_LLVM >= 0x0309
++ llvm::Triple(triple), c.getPreprocessorOpts(),
++#endif
+ clang::LangStandard::lang_opencl11);
+ c.createDiagnostics(
+ new clang::TextDiagnosticPrinter(
+@@ -322,6 +325,15 @@
+ // list of kernel functions to the internalizer. The internalizer will
+ // treat the functions in the list as "main" functions and internalize
+ // all of the other functions.
++#if HAVE_LLVM >= 0x0309
++ auto preserve_kernels = [=](const llvm::GlobalValue &GV) {
++ for (const auto &kernel : kernels) {
++ if (GV.getName() == kernel->getName())
++ return true;
++ }
++ return false;
++ };
++#else
+ std::vector<const char*> export_list;
+ for (std::vector<llvm::Function *>::const_iterator I = kernels.begin(),
+ E = kernels.end();
+@@ -329,12 +341,17 @@
+ llvm::Function *kernel = *I;
+ export_list.push_back(kernel->getName().data());
+ }
++#endif
+ #if HAVE_LLVM < 0x0306
+ PM.add(new llvm::DataLayoutPass(mod));
+ #elif HAVE_LLVM < 0x0307
+ PM.add(new llvm::DataLayoutPass());
+ #endif
++#if HAVE_LLVM >= 0x0309
++ PM.add(llvm::createInternalizePass(preserve_kernels));
++#else
+ PM.add(llvm::createInternalizePass(export_list));
++#endif
+
+ llvm::PassManagerBuilder PMB;
+ PMB.OptLevel = optimization_level;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment