void-packages/srcpkgs/beignet/patches/llvm09.patch

112 lines
5.1 KiB
Diff

Source: FreeBSD + q66
Mostly FreeBSD other than FindLLVM.cmake changes.
Linking against clang-cpp does not work for us.
--- a/CMake/FindLLVM.cmake
+++ b/CMake/FindLLVM.cmake
@@ -140,6 +140,7 @@ add_one_lib("clangStaticAnalyzerCore")
add_one_lib("clangAnalysis")
add_one_lib("clangEdit")
add_one_lib("clangAST")
+add_one_lib("clangASTMatchers")
add_one_lib("clangParse")
add_one_lib("clangSema")
add_one_lib("clangLex")
--- a/backend/src/llvm/llvm_intrinsic_lowering.cpp 2017-10-24 06:04:48 UTC
+++ b/backend/src/llvm/llvm_intrinsic_lowering.cpp
@@ -77,7 +77,11 @@ namespace gbe {
std::vector<Type *> ParamTys;
for (Value** I = ArgBegin; I != ArgEnd; ++I)
ParamTys.push_back((*I)->getType());
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
+ FunctionCallee FCache = M->getOrInsertFunction(NewFn,
+#else
Constant* FCache = M->getOrInsertFunction(NewFn,
+#endif
FunctionType::get(RetTy, ParamTys, false));
IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
--- a/backend/src/llvm/llvm_sampler_fix.cpp 2017-10-24 06:04:48 UTC
+++ b/backend/src/llvm/llvm_sampler_fix.cpp
@@ -82,7 +82,11 @@ namespace gbe {
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
Module *M = I->getParent()->getParent()->getParent();
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
+ FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+#else
Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+#endif
#else
Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
#endif
@@ -124,7 +128,11 @@ namespace gbe {
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
Module *M = I->getParent()->getParent()->getParent();
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
+ FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+#else
Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+#endif
#else
Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
#endif
--- a/backend/src/llvm/llvm_profiling.cpp 2017-10-24 06:04:48 UTC
+++ b/backend/src/llvm/llvm_profiling.cpp
@@ -163,10 +163,18 @@ namespace gbe
// __gen_ocl_store_timestamp(int nth, int type);
Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
+ builder->CreateCall(module->getOrInsertFunction(
+#else
builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+#endif
"__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
IntegerType::getInt32Ty(module->getContext()),
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
+ IntegerType::getInt32Ty(module->getContext())),
+#else
IntegerType::getInt32Ty(module->getContext()))),
+#endif
ArrayRef<Value*>(Args));
#else
builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
@@ -185,10 +193,18 @@ namespace gbe
Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
+ builder->CreateCall(module->getOrInsertFunction(
+#else
builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+#endif
"__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
ptrTy,
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
+ IntegerType::getInt32Ty(module->getContext())),
+#else
IntegerType::getInt32Ty(module->getContext()))),
+#endif
ArrayRef<Value*>(Args2));
#else
builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
--- a/backend/src/llvm/llvm_device_enqueue.cpp 2017-10-24 06:04:48 UTC
+++ b/backend/src/llvm/llvm_device_enqueue.cpp
@@ -398,8 +398,13 @@ namespace gbe {
std::vector<Type *> ParamTys;
for (Value** iter = args.begin(); iter != args.end(); ++iter)
ParamTys.push_back((*iter)->getType());
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
+ CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
+ "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
+#else
CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
"__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
+#endif
CI->replaceAllUsesWith(newCI);
deadInsnSet.insert(CI);
}