[CUDA] Fix llvm::createInternalizePass() for LLVM trunk
@@ -426,7 +426,15 @@ void pocl_cuda_link_libdevice(llvm::Module *module,
llvm::legacy::PassManager passes;
// Run internalize to mark all non-kernel functions as internal
+#ifdef LLVM_OLDER_THAN_3_9
passes.add(llvm::createInternalizePass({kernel}));
+#else
+ auto preserve_kernel = [=](const llvm::GlobalValue &GV)
+ {
+ return GV.getName() == kernel;
+ };
+ passes.add(llvm::createInternalizePass(preserve_kernel));
+#endif
// Run NVVM reflect pass to set math options
// TODO: Determine correct FTZ value from frontend compiler options
