summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch')
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch318
1 files changed, 0 insertions, 318 deletions
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch
deleted file mode 100644
index 6580df75..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch
+++ /dev/null
@@ -1,318 +0,0 @@
1From 60136b453bb3a109bfc88c4040b871af9d522ed5 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
3Date: Thu, 25 Feb 2021 19:40:21 +0100
4Subject: [PATCH 2/3] Review fixes for LLVM 12 phase 1
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Upstream-Status: Pending
10
11Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
12Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
13---
14 IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 6 +-----
15 IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 6 +-----
16 IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | 7 ++-----
17 IGC/Compiler/CISACodeGen/Simd32Profitability.cpp | 7 ++-----
18 IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | 11 +----------
19 IGC/Compiler/GenTTI.cpp | 9 ++-------
20 IGC/Compiler/Legalizer/InstPromoter.cpp | 8 +-------
21 .../DeviceEnqueueFuncs/TransformBlocks.cpp | 6 +-----
22 .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp | 4 ----
23 IGC/Compiler/Optimizer/Scalarizer.cpp | 2 +-
24 IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h | 10 ++++++++++
25 .../include/llvmWrapper/Support/TypeSize.h | 4 +---
26 .../include/llvmWrapper/Transforms/Utils/LoopUtils.h | 8 ++++++++
27 IGC/common/igc_resourceDimTypes.h | 5 ++---
28 14 files changed, 33 insertions(+), 60 deletions(-)
29
30diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
31index 725a1512..12f42be8 100644
32--- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
33+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
34@@ -1929,11 +1929,7 @@ SPIRVToLLVM::transType(SPIRVType *T) {
35 auto name = isSubgroupAvcINTELTypeOpCode(OC) ?
36 OCLSubgroupINTELTypeOpCodeMap::rmap(OC) :
37 BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC);
38-#if LLVM_VERSION_MAJOR >= 12
39- auto *pST = llvm::StructType::getTypeByName(M->getContext(), name);
40-#else
41- auto *pST = M->getTypeByName(name);
42-#endif
43+ auto *pST = IGCLLVM::getTypeByName(M, name);
44 pST = pST ? pST : StructType::create(*Context, name);
45
46 return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC)));
47diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
48index 91b4623c..f4f0dee5 100644
49--- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
50+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
51@@ -93,11 +93,7 @@ saveLLVMModule(Module *M, const std::string &OutputFile) {
52 PointerType*
53 getOrCreateOpaquePtrType(Module *M, const std::string &Name,
54 unsigned AddrSpace) {
55-#if LLVM_VERSION_MAJOR >= 12
56- auto OpaqueType = llvm::StructType::getTypeByName(M->getContext(), Name);
57-#else
58- auto OpaqueType = M->getTypeByName(Name);
59-#endif
60+ auto OpaqueType = IGCLLVM::getTypeByName(M, Name);
61 if (!OpaqueType)
62 OpaqueType = StructType::create(M->getContext(), Name);
63 return PointerType::get(OpaqueType, AddrSpace);
64diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
65index fc45a510..a612a473 100644
66--- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
67+++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
68@@ -33,6 +33,7 @@ IN THE SOFTWARE.
69 #include <llvm/Support/Debug.h>
70 #include <llvm/Support/raw_ostream.h>
71 #include <llvm/Transforms/Utils/Local.h>
72+#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
73 #include "common/LLVMWarningsPop.hpp"
74 #include "GenISAIntrinsics/GenIntrinsics.h"
75 #include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
76@@ -134,11 +135,7 @@ bool AdvMemOpt::runOnFunction(Function& F) {
77 for (auto I = LI->begin(), E = LI->end(); I != E; ++I)
78 for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) {
79 Loop* L = *DFI;
80-#if LLVM_VERSION_MAJOR >= 12
81- if (L->isInnermost())
82-#else
83- if (L->empty())
84-#endif
85+ if (IGCLLVM::isInnermost(L))
86 InnermostLoops.push_back(L);
87 }
88
89diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
90index c1f4a419..5393d4e8 100644
91--- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
92+++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
93@@ -28,6 +28,7 @@ IN THE SOFTWARE.
94 #include "Compiler/CISACodeGen/Platform.hpp"
95 #include "common/LLVMWarningsPush.hpp"
96 #include <llvmWrapper/IR/DerivedTypes.h>
97+#include <llvmWrapper/Transforms/Utils/LoopUtils.h>
98 #include <llvm/IR/InstIterator.h>
99 #include <llvm/IR/Operator.h>
100 #include <llvmWrapper/IR/DerivedTypes.h>
101@@ -995,11 +996,7 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI)
102 // Collect innermost simple loop.
103 for (auto I = LI->begin(), E = LI->end(); I != E; ++I) {
104 auto L = *I;
105-#if LLVM_VERSION_MAJOR >= 12
106- if (!L->isInnermost())
107-#else
108- if (!L->empty())
109-#endif
110+ if (!IGCLLVM::isInnermost(L))
111 continue;
112 if (L->getNumBlocks() != 2)
113 continue;
114diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
115index adf992cb..33473c23 100644
116--- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
117+++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
118@@ -153,21 +153,12 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
119 // In OGL there are uses of ldmcs other then ldms, using vec4float type.
120 // Fix them to use newly created 16bit ldmcs.
121 if (ldmcs->getType()->isVectorTy() &&
122-#if LLVM_VERSION_MAJOR >= 12
123- ldmcs->getType()->getScalarType()->isFloatTy())
124-#else
125- ldmcs->getType()->getVectorElementType()->isFloatTy())
126-#endif
127+ cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getElementType()->isFloatTy())
128 {
129 m_builder->SetInsertPoint(ldmcs);
130
131-#if LLVM_VERSION_MAJOR >= 12
132 uint ldmcsNumOfElements = cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements();
133 uint new_mcs_callNumOfElements = cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements();
134-#else
135- uint ldmcsNumOfElements = ldmcs->getType()->getVectorNumElements();
136- uint new_mcs_callNumOfElements = new_mcs_call->getType()->getVectorNumElements();
137-#endif
138
139 // vec of 16bit ints to vec of 32bit ints
140 Type* new_mcs_callVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements);
141diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp
142index 9e4d2f26..53e3ec9e 100644
143--- a/IGC/Compiler/GenTTI.cpp
144+++ b/IGC/Compiler/GenTTI.cpp
145@@ -37,6 +37,7 @@ IN THE SOFTWARE.
146 #include "llvm/Analysis/LoopInfo.h"
147 #include "llvm/Analysis/ScalarEvolution.h"
148 #include "llvm/Support/raw_ostream.h"
149+#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
150 #include "common/LLVMWarningsPop.hpp"
151
152 using namespace llvm;
153@@ -216,13 +217,7 @@ namespace llvm {
154
155 // Skip non-simple loop.
156 if (L->getNumBlocks() != 1) {
157- if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) &&
158-#if LLVM_VERSION_MAJOR >= 12
159- L->isInnermost()
160-#else
161- L->empty()
162-#endif
163- ) {
164+ if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && IGCLLVM::isInnermost(L)) {
165 auto countNonPHI = [](BasicBlock* BB) {
166 unsigned Total = BB->size();
167 unsigned PHIs = 0;
168diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp
169index 8fadf89f..63cbccb5 100644
170--- a/IGC/Compiler/Legalizer/InstPromoter.cpp
171+++ b/IGC/Compiler/Legalizer/InstPromoter.cpp
172@@ -398,13 +398,7 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) {
173 IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N));
174
175 std::vector<Constant*> Vals;
176- for (unsigned i = 0;
177-#if LLVM_VERSION_MAJOR >= 12
178- i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements();
179-#else
180- i < DestTy->getVectorNumElements();
181-#endif
182- i++)
183+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements(); i++)
184 Vals.push_back(IRB->getInt32(i));
185
186 Value* Mask = ConstantVector::get(Vals);
187diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
188index 119520ed..a3681b79 100644
189--- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
190+++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
191@@ -952,11 +952,7 @@ namespace //Anonymous
192 {
193 auto ndrangeStructName = "struct.ndrange_t";
194 auto module = _deviceExecCall->getModule();
195-#if LLVM_VERSION_MAJOR >= 12
196- auto ndrangeTy = llvm::StructType::getTypeByName(module->getContext(), ndrangeStructName);
197-#else
198- auto ndrangeTy = module->getTypeByName(ndrangeStructName);
199-#endif
200+ auto ndrangeTy = IGCLLVM::getTypeByName(module, ndrangeStructName);
201 if (ndrangeTy == nullptr)
202 {
203 //create struct type
204diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
205index 535d6268..c23c661d 100644
206--- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
207+++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
208@@ -303,11 +303,7 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType)
209 auto Size = ElemByteSize;
210 if (DataType->isVectorTy())
211 {
212-#if LLVM_VERSION_MAJOR >= 12
213 Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements();
214-#else
215- Size *= DataType->getVectorNumElements();
216-#endif
217 }
218 unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize;
219 unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2;
220diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp
221index a4e73a6d..38627553 100644
222--- a/IGC/Compiler/Optimizer/Scalarizer.cpp
223+++ b/IGC/Compiler/Optimizer/Scalarizer.cpp
224@@ -778,7 +778,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
225
226 // Generate array for shuffled scalar values
227 SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector;
228- unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
229+ unsigned width = int_cast<unsigned>(cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
230
231 // Generate undef value, which may be needed as some scalar elements
232 UndefValue* undef = UndefValue::get(inputType->getElementType());
233diff --git a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
234index a3f5a0b8..6a5407bb 100644
235--- a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
236+++ b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
237@@ -29,6 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
238
239 #include "llvm/Config/llvm-config.h"
240 #include "llvm/IR/DerivedTypes.h"
241+#include "llvm/IR/Module.h"
242
243 namespace IGCLLVM
244 {
245@@ -62,6 +63,15 @@ namespace IGCLLVM
246 return false;
247 #endif
248 }
249+
250+ inline llvm::StructType *getTypeByName(llvm::Module *M, llvm::StringRef Name) {
251+#if LLVM_VERSION_MAJOR >= 12
252+ return llvm::StructType::getTypeByName(M->getContext(), Name);
253+#else
254+ return M->getTypeByName(Name);
255+#endif
256+ }
257+
258 }
259
260 #endif
261diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
262index 30e29720..7021820c 100644
263--- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
264+++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
265@@ -39,12 +39,10 @@ inline unsigned getElementCount(unsigned EC) { return EC; }
266 inline ElementCount getElementCount(unsigned EC) {
267 return ElementCount(EC, false);
268 }
269-#elif LLVM_VERSION_MAJOR == 12
270+#else
271 inline ElementCount getElementCount(unsigned EC) {
272 return ElementCount::get(EC, false);
273 }
274-#else
275-#error "unsupported LLVM version"
276 #endif
277 } // namespace IGCLLVM
278
279diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
280index db47b00b..bce9cfc1 100644
281--- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
282+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
283@@ -41,6 +41,14 @@ namespace IGCLLVM
284 return llvm::InsertPreheaderForLoop(L, DT, LI, nullptr, PreserveLCSSA);
285 }
286 #endif
287+
288+ inline bool isInnermost(llvm::Loop *L) {
289+#if LLVM_VERSION_MAJOR >= 12
290+ return L->isInnermost();
291+#else
292+ return L->empty();
293+#endif
294+ }
295 }
296
297 #endif
298diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h
299index d790330f..2d675969 100644
300--- a/IGC/common/igc_resourceDimTypes.h
301+++ b/IGC/common/igc_resourceDimTypes.h
302@@ -67,10 +67,9 @@ namespace IGC
303 resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE));
304
305 #if LLVM_VERSION_MAJOR >= 12
306- llvm::LLVMContext& llvmCtx = module.getContext();
307- return llvm::StructType::getTypeByName(llvmCtx, ResourceDimensionTypeName[resourceDimTypeId]);
308+ return llvm::StructType::getTypeByName(module.getContext(), ResourceDimensionTypeName[resourceDimTypeId]);
309 #else
310 return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]);
311 #endif
312 }
313-}
314\ No newline at end of file
315+}
316--
3172.17.1
318