summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Lass2019-12-01 18:23:55 +0100
committerMichael Lass2019-12-01 22:34:13 +0100
commit90648e8c5be33987cd92bfac910b2e9db1fc21db (patch)
tree9938ffc2cb666b5a4be68c98c4aecb09ad4aa777
parentd58cef24046d2e4e882c71c53fddd7df4fd4cc0f (diff)
downloadaur-90648e8c5be33987cd92bfac910b2e9db1fc21db.tar.gz
Fix build against current git version
This introduces a couple of changes: * match more closely the version in the community repository * change git url to github as it contains newer commits * build against LLVM 7, as this is currently the most recent version supported by upstream * add optional patch to resolve undefined behavior / segfaults * build with cmake and ninja
-rw-r--r--.SRCINFO40
-rw-r--r--GBE-let-GenRegister-reg-never-return-uninitialized-m.patch37
-rw-r--r--PKGBUILD93
-rw-r--r--llvm8.patch56
-rw-r--r--llvm9.patch182
5 files changed, 362 insertions, 46 deletions
diff --git a/.SRCINFO b/.SRCINFO
index ea8e84613756..ccf9e5c2a841 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,33 +1,33 @@
pkgbase = beignet-git
- pkgdesc = A GPGPU System for Intel Ivybridge GPUs
- pkgver = 1.0.0.r799.gcf95b44
+ pkgdesc = An open source OpenCL implementation for Intel IvyBridge & Haswell iGPUs
+ pkgver = 1.0.0.r1395.g419c0417
pkgrel = 1
- url = http://cgit.freedesktop.org/beignet/
+ url = https://01.org/beignet
arch = x86_64
- license = LGPL2.1
- makedepends = clang
+ license = LGPL
+ makedepends = git
+ makedepends = llvm70
makedepends = cmake
- makedepends = python2
+ makedepends = ninja
+ makedepends = python
+ makedepends = ocl-icd
depends = glu
- depends = libsm
- depends = libxext
+ depends = clang70
depends = mesa
- depends = ncurses
- depends = ocl-icd
- depends = llvm
+ depends = opencl-headers
+ provides = beignet
provides = opencl-intel
- provides = opencl-headers
- provides = opencl-headers12
+ provides = opencl-driver
conflicts = beignet
conflicts = opencl-intel
- conflicts = opencl-headers
- conflicts = opencl-headers12
- replaces = beignet
- replaces = opencl-intel
- replaces = opencl-headers
- replaces = opencl-headers12
- source = git://anongit.freedesktop.org/beignet
+ source = git+https://github.com/intel/beignet.git
+ source = GBE-let-GenRegister-reg-never-return-uninitialized-m.patch
+ source = llvm8.patch
+ source = llvm9.patch
sha256sums = SKIP
+ sha256sums = c1f5880bb192103c371d51f57f646837ca01a8bbe012b9022d4e345c2f1187de
+ sha256sums = f16b13a3263b5042081094cd20c9e09c20a3a6d6e1dd796f460e4f447cfbb598
+ sha256sums = 2a0229629ad228b54fdb930d18a94c6879024a41b43ed5265c758bf508cd4bc6
pkgname = beignet-git
diff --git a/GBE-let-GenRegister-reg-never-return-uninitialized-m.patch b/GBE-let-GenRegister-reg-never-return-uninitialized-m.patch
new file mode 100644
index 000000000000..7f6efa7d14b1
--- /dev/null
+++ b/GBE-let-GenRegister-reg-never-return-uninitialized-m.patch
@@ -0,0 +1,37 @@
+From e837f9f4c6133d8ef56923ffbdbca224b1d7aa23 Mon Sep 17 00:00:00 2001
+From: Michael Lass <bevan@bi-co.net>
+Date: Sun, 1 Dec 2019 13:05:45 +0100
+Subject: [PATCH] GBE: let GenRegister::reg() never return uninitialized memory
+
+GenRegister::reg() is called throughout the code, not only on virtual
+but also on physical registers. For the latter, value.reg is not
+initialized and therefore reg() returns uninitialized memory, leading to
+undefined behavior. Make sure to always return initialized memory by
+returning a valid ir::Register, even for physical registers.
+
+Fixes https://gitlab.freedesktop.org/beignet/beignet/issues/12
+---
+ backend/src/backend/gen_register.hpp | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/backend/src/backend/gen_register.hpp b/backend/src/backend/gen_register.hpp
+index 6c73f5e6..78846c91 100644
+--- a/backend/src/backend/gen_register.hpp
++++ b/backend/src/backend/gen_register.hpp
+@@ -243,7 +243,12 @@ namespace gbe
+ }
+
+ /*! Return the IR virtual register */
+- INLINE ir::Register reg(void) const { return ir::Register(value.reg); }
++ INLINE ir::Register reg(void) const {
++ if (this->physical)
++ return ir::Register();
++ else
++ return ir::Register(value.reg);
++ }
+
+ /*! For immediates or virtual register */
+ union {
+--
+2.24.0
+
diff --git a/PKGBUILD b/PKGBUILD
index 75e2e93fe5e5..342e9c92dc06 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,37 +1,78 @@
-# Current Maintainer: Sean Lynch <seanl@literati.org>
+# Maintainer: Michael Lass <bevan@bi-co.net>
+# Contributor: Sean Lynch <seanl@literati.org>
+# Contributor: Bruno Pagani <archange@archlinux.org>
+# Contributor: Antoine Lubineau <antoine@lubignon.info>
+# Contributor: Leopold Bloom <blinxwang@gmail.com>
+# Contributor: Michal Krenek (a.k.a. Mikos) <m.krenek@gmail.com>
+
+# For me, the compiler_rotate() utest fails when built with Clang 9.
+# I therefore by default stick to Clang 7 for which support is somehow
+# maintained upstream by Debian developers. Patches to build against
+# Clang 9 are however included and can be simply commented in.
+# - Michael
+
pkgname=beignet-git
-pkgver=1.0.0.r799.gcf95b44
+pkgver=1.0.0.r1395.g419c0417
pkgrel=1
-pkgdesc='A GPGPU System for Intel Ivybridge GPUs'
-arch=('x86_64')
-url='http://cgit.freedesktop.org/beignet/'
-license=('LGPL2.1')
-depends=('glu' 'libsm' 'libxext' 'mesa' 'ncurses' 'ocl-icd' 'llvm')
-makedepends=('clang' 'cmake' 'python2')
-provides=('opencl-intel' 'opencl-headers' 'opencl-headers12')
-conflicts=('beignet' 'opencl-intel' 'opencl-headers' 'opencl-headers12')
-replaces=('beignet' 'opencl-intel' 'opencl-headers' 'opencl-headers12')
-source=("git://anongit.freedesktop.org/beignet")
-sha256sums=('SKIP')
+pkgdesc="An open source OpenCL implementation for Intel IvyBridge & Haswell iGPUs"
+arch=(x86_64)
+url="https://01.org/beignet"
+license=(LGPL)
+depends=(glu clang70 mesa opencl-headers)
+makedepends=(git llvm70 cmake ninja python ocl-icd)
+provides=(beignet opencl-intel opencl-driver)
+conflicts=(beignet opencl-intel)
+source=("git+https://github.com/intel/beignet.git"
+ 'GBE-let-GenRegister-reg-never-return-uninitialized-m.patch'
+ 'llvm8.patch'
+ 'llvm9.patch')
+sha256sums=('SKIP'
+ 'c1f5880bb192103c371d51f57f646837ca01a8bbe012b9022d4e345c2f1187de'
+ 'f16b13a3263b5042081094cd20c9e09c20a3a6d6e1dd796f460e4f447cfbb598'
+ '2a0229629ad228b54fdb930d18a94c6879024a41b43ed5265c758bf508cd4bc6')
function pkgver() {
- cd "$srcdir/beignet"
- git describe --long --tags | sed 's/^Release_v//;s/-/.r/;s/-/./'
+ cd "$srcdir/beignet"
+ git describe --long --tags | sed 's/^Release_v//;s/-/.r/;s/-/./'
+}
+
+prepare() {
+ mkdir -p build
+ cd beignet
+
+ # Remove implementation of cl_intel_device_side_avc_motion_estimation
+ # (conflicts with the implemention in Clang 8)
+ # git revert -n 9b7ca443cf7b d61933205874 a4257c7475e7 5a288032ab23 9cb7ff4c285d
+
+ # Static linking leads to build failure
+ git revert -n 1bd0d252d733
+
+ # Fix undefined behavior
+ # See:
+ # * https://github.com/intel/beignet/pull/16
+ # * https://gitlab.freedesktop.org/beignet/beignet/issues/12
+ # patch -Np1 -i ../GBE-let-GenRegister-reg-never-return-uninitialized-m.patch
+
+ # Patches from FreeBSD to build with newer LLVM
+ # patch -Np0 -i ../llvm8.patch
+ # patch -Np0 -i ../llvm9.patch
}
build() {
- cd "$srcdir/beignet"
- mkdir -p "$srcdir/beignet/build"
- cd "$srcdir/beignet/build"
- cmake .. \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DCMAKE_INSTALL_LIBDIR=/usr/lib \
- -DCMAKE_BUILD_TYPE=RELEASE \
- -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python2
- make
+ cd build
+ cmake -G Ninja ../beignet \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_LIBDIR=/usr/lib \
+ -DCMAKE_BUILD_TYPE=RELEASE \
+ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE \
+ -DLLVM_INSTALL_DIR=/opt/llvm70/bin
+ ninja
}
package() {
- cd "$srcdir/beignet/build"
- make DESTDIR="$pkgdir/" install
+ cd build
+ DESTDIR="${pkgdir}" ninja install
+ # Remove headers already provided by 'opencl-headers'
+ cd "${pkgdir}/usr/include/CL"
+ rm cl.h cl_egl.h cl_ext.h cl_gl.h cl_gl_ext.h cl_platform.h opencl.h
}
diff --git a/llvm8.patch b/llvm8.patch
new file mode 100644
index 000000000000..15128d1a1151
--- /dev/null
+++ b/llvm8.patch
@@ -0,0 +1,56 @@
+From 75c152599a7c1739e6dadcdb9b377acf7e44d9cf Mon Sep 17 00:00:00 2001
+From: Jan Beich <jbeich@FreeBSD.org>
+Date: Wed, 30 Jan 2019 12:42:34 +0000
+Subject: [PATCH] lang/beignet: unbreak with llvm80
+
+Regressed by https://github.com/llvm/llvm-project/commit/721d95713a9e
+
+unable to load /usr/local/lib/beignet//libgbeinterp.so which is part of the driver, please check!
+ld-elf.so.1: /usr/local/lib/beignet//libgbeinterp.so: Undefined symbol "_ZN4llvm24DisableABIBreakingChecksE"
+
+Regressed by https://github.com/llvm/llvm-project/commit/4a2d58e16acc
+
+backend/src/llvm/llvm_gen_backend.cpp:3076:5: error:
+ unknown type name 'TerminatorInst'
+ TerminatorInst *term = bb->getTerminator();
+ ^
+backend/src/llvm/llvm_gen_backend.cpp:3083:5: error:
+ unknown type name 'TerminatorInst'
+ TerminatorInst *term = bb->getTerminator();
+ ^
+
+--- backend/src/CMakeLists.txt.orig 2017-09-22 08:05:22 UTC
++++ backend/src/CMakeLists.txt
+@@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
+ endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
+
+ add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
++target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS})
+
+ if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
+ find_library(TERMINFO NAMES tinfo ncurses)
+--- backend/src/llvm/llvm_gen_backend.cpp.orig 2017-10-24 06:04:48 UTC
++++ backend/src/llvm/llvm_gen_backend.cpp
+@@ -3073,14 +3073,22 @@ namespace gbe
+
+
+ static unsigned getChildNo(BasicBlock *bb) {
++#if LLVM_VERSION_MAJOR < 8
+ TerminatorInst *term = bb->getTerminator();
++#else
++ Instruction *term = bb->getTerminator();
++#endif
+ return term->getNumSuccessors();
+ }
+
+ // return NULL if index out-range of children number
+ static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
+
++#if LLVM_VERSION_MAJOR < 8
+ TerminatorInst *term = bb->getTerminator();
++#else
++ Instruction *term = bb->getTerminator();
++#endif
+ unsigned childNo = term->getNumSuccessors();
+ BasicBlock *child = NULL;
+ if(index < childNo) {
diff --git a/llvm9.patch b/llvm9.patch
new file mode 100644
index 000000000000..a912131dcf7c
--- /dev/null
+++ b/llvm9.patch
@@ -0,0 +1,182 @@
+Regressed by https://github.com/llvm/llvm-project/commit/2e97d2aa1bd3
+
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::addMatcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&, clang::ast_matchers::MatchFinder::MatchCallback*)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::match(clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchFinder(clang::ast_matchers::MatchFinder::MatchFinderOptions)
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::~MatchFinder()
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxMethodDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxRecordDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unaryOperator
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructorDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxOperatorCallExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::expr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::allOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::anyOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::eachOf
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unless
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::varDecl
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::callExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::castExpr
+ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::internal::hasAnyNameFunc(llvm::ArrayRef<llvm::StringRef const*>)
+ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
+c++: error: linker command failed with exit code 1 (use -v to see invocation)
+
+Regressed by https://github.com/llvm/llvm-project/commit/13680223b9d8
+
+backend/src/llvm/llvm_intrinsic_lowering.cpp:80:19: error:
+ no viable conversion from 'llvm::FunctionCallee' to 'llvm::Constant *'
+ Constant* FCache = M->getOrInsertFunction(NewFn,
+ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:85:18: error:
+ no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+ ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_sampler_fix.cpp:127:18: error:
+ no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
+ ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
+ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_profiling.cpp:166:27: error: no
+ matching function for call to 'cast'
+ builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+ ^~~~~~~~~~~~~~~~~~~~
+backend/src/llvm/llvm_device_enqueue.cpp:401:52: error:
+ no matching function for call to 'cast'
+ CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+ ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+ = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+ ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+ '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+ llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+ 'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+ ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+ 'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+backend/src/llvm/llvm_profiling.cpp:188:25: error: no
+ matching function for call to 'cast'
+ builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+ ^~~~~~~~~~~~~~~~~~~~
+/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
+ = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
+inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
+ ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
+ '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
+ llvm::FunctionCallee]
+cast(const Y &Val) {
+^
+/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
+ 'Y *' against 'llvm::FunctionCallee'
+inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
+ ^
+/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
+ 'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
+cast(std::unique_ptr<Y> &&Val) {
+^
+
+--- backend/src/llvm/llvm_intrinsic_lowering.cpp.orig 2017-10-24 06:04:48 UTC
++++ 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));
+--- backend/src/llvm/llvm_sampler_fix.cpp.orig 2017-10-24 06:04:48 UTC
++++ 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
+--- backend/src/llvm/llvm_profiling.cpp.orig 2017-10-24 06:04:48 UTC
++++ 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(
+--- backend/src/llvm/llvm_device_enqueue.cpp.orig 2017-10-24 06:04:48 UTC
++++ 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);
+ }