View | Details | Raw Unified | Return to bug 239175 | Differences between
and this patch

Collapse All | Expand All

(-)b/lang/beignet/files/patch-llvm9 (+194 lines)
Added Link Here
1
Regressed by https://github.com/llvm/llvm-project/commit/2e97d2aa1bd3
2
3
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*)
4
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()
5
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::match(clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&)
6
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchFinder(clang::ast_matchers::MatchFinder::MatchFinderOptions)
7
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::~MatchFinder()
8
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxMethodDecl
9
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxRecordDecl
10
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unaryOperator
11
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructExpr
12
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructorDecl
13
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxOperatorCallExpr
14
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::expr
15
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::allOf
16
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::anyOf
17
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::eachOf
18
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unless
19
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::varDecl
20
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::callExpr
21
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::castExpr
22
ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::internal::hasAnyNameFunc(llvm::ArrayRef<llvm::StringRef const*>)
23
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
24
c++: error: linker command failed with exit code 1 (use -v to see invocation)
25
26
Regressed by https://github.com/llvm/llvm-project/commit/13680223b9d8
27
28
backend/src/llvm/llvm_intrinsic_lowering.cpp:80:19: error:
29
      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Constant *'
30
        Constant* FCache = M->getOrInsertFunction(NewFn,
31
                  ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32
backend/src/llvm/llvm_sampler_fix.cpp:85:18: error:
33
      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
34
  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
35
            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
backend/src/llvm/llvm_sampler_fix.cpp:127:18: error:
37
      no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
38
  ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
39
            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40
backend/src/llvm/llvm_profiling.cpp:166:27: error: no
41
      matching function for call to 'cast'
42
      builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
43
                          ^~~~~~~~~~~~~~~~~~~~
44
backend/src/llvm/llvm_device_enqueue.cpp:401:52: error:
45
      no matching function for call to 'cast'
46
              CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
47
                                                   ^~~~~~~~~~~~~~~~~~~~
48
/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
49
      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
50
inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
51
                                           ^
52
/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
53
      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
54
      llvm::FunctionCallee]
55
cast(const Y &Val) {
56
^
57
/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
58
      'Y *' against 'llvm::FunctionCallee'
59
inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
60
                                             ^
61
/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
62
      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
63
cast(std::unique_ptr<Y> &&Val) {
64
^
65
backend/src/llvm/llvm_profiling.cpp:188:25: error: no
66
      matching function for call to 'cast'
67
    builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
68
                        ^~~~~~~~~~~~~~~~~~~~
69
/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
70
      = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
71
inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
72
                                           ^
73
/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
74
      '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
75
      llvm::FunctionCallee]
76
cast(const Y &Val) {
77
^
78
/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
79
      'Y *' against 'llvm::FunctionCallee'
80
inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
81
                                             ^
82
/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
83
      'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
84
cast(std::unique_ptr<Y> &&Val) {
85
^
86
87
--- CMake/FindLLVM.cmake.orig	2017-09-22 08:05:22 UTC
88
+++ CMake/FindLLVM.cmake
89
@@ -116,6 +116,9 @@ macro(add_one_lib name)
90
 endmacro()
91
 
92
 #Assume clang lib path same as llvm lib path
93
+if (LLVM_VERSION_NODOT VERSION_GREATER 80)
94
+add_one_lib("clang-cpp")
95
+endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
96
 add_one_lib("clangCodeGen")
97
 add_one_lib("clangFrontend")
98
 add_one_lib("clangSerialization")
99
--- backend/src/llvm/llvm_intrinsic_lowering.cpp.orig	2017-10-24 06:04:48 UTC
100
+++ backend/src/llvm/llvm_intrinsic_lowering.cpp
101
@@ -77,7 +77,11 @@ namespace gbe {
102
         std::vector<Type *> ParamTys;
103
         for (Value** I = ArgBegin; I != ArgEnd; ++I)
104
           ParamTys.push_back((*I)->getType());
105
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
106
+        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
107
+#else
108
         Constant* FCache = M->getOrInsertFunction(NewFn,
109
+#endif
110
                                         FunctionType::get(RetTy, ParamTys, false));
111
 
112
         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
113
--- backend/src/llvm/llvm_sampler_fix.cpp.orig	2017-10-24 06:04:48 UTC
114
+++ backend/src/llvm/llvm_sampler_fix.cpp
115
@@ -82,7 +82,11 @@ namespace gbe {
116
 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
117
           Module *M = I->getParent()->getParent()->getParent();
118
 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
119
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
120
+          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
121
+#else
122
           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
123
+#endif
124
 #else
125
           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
126
 #endif
127
@@ -124,7 +128,11 @@ namespace gbe {
128
 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
129
           Module *M = I->getParent()->getParent()->getParent();
130
 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
131
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
132
+          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
133
+#else
134
           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
135
+#endif
136
 #else
137
           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
138
 #endif
139
--- backend/src/llvm/llvm_profiling.cpp.orig	2017-10-24 06:04:48 UTC
140
+++ backend/src/llvm/llvm_profiling.cpp
141
@@ -163,10 +163,18 @@ namespace gbe
142
       // __gen_ocl_store_timestamp(int nth, int type);
143
       Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
144
 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
145
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
146
+      builder->CreateCall(module->getOrInsertFunction(
147
+#else
148
       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
149
+#endif
150
               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
151
               IntegerType::getInt32Ty(module->getContext()),
152
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
153
+              IntegerType::getInt32Ty(module->getContext())),
154
+#else
155
               IntegerType::getInt32Ty(module->getContext()))),
156
+#endif
157
               ArrayRef<Value*>(Args));
158
 #else
159
       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
160
@@ -185,10 +193,18 @@ namespace gbe
161
     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
162
 
163
 #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
164
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
165
+    builder->CreateCall(module->getOrInsertFunction(
166
+#else
167
     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
168
+#endif
169
             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
170
             ptrTy,
171
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
172
+            IntegerType::getInt32Ty(module->getContext())),
173
+#else
174
             IntegerType::getInt32Ty(module->getContext()))),
175
+#endif
176
             ArrayRef<Value*>(Args2));
177
 #else
178
     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
179
--- backend/src/llvm/llvm_device_enqueue.cpp.orig	2017-10-24 06:04:48 UTC
180
+++ backend/src/llvm/llvm_device_enqueue.cpp
181
@@ -398,8 +398,13 @@ namespace gbe {
182
               std::vector<Type *> ParamTys;
183
               for (Value** iter = args.begin(); iter != args.end(); ++iter)
184
                 ParamTys.push_back((*iter)->getType());
185
+#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
186
+              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
187
+                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
188
+#else
189
               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
190
                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
191
+#endif
192
               CI->replaceAllUsesWith(newCI);
193
               deadInsnSet.insert(CI);
194
             }

Return to bug 239175