diff options
author | Anuj Mittal <anuj.mittal@intel.com> | 2021-10-05 00:33:39 +0800 |
---|---|---|
committer | Anuj Mittal <anuj.mittal@intel.com> | 2021-10-07 22:51:26 +0800 |
commit | 2d445772a75958768cd9e4e5b15831be9ef34022 (patch) | |
tree | 05a095392a1a96530258c3e6a21e2ee4d52876d5 /dynamic-layers/clang-layer | |
parent | e33256049735d4cec53b9550770ee52c755fab90 (diff) | |
download | meta-intel-2d445772a75958768cd9e4e5b15831be9ef34022.tar.gz |
intel-graphics-compiler: upgrade 1.0.8365 -> 1.0.8744
Build vc-intrintics as part of this project as igc expects it to. Remove
the LLVM fixes as they are all available upstream now. Also depend on
-native for invoking elf_packager.
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'dynamic-layers/clang-layer')
-rw-r--r-- | dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch | 437 | ||||
-rw-r--r-- | dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-llvm_deps.cmake-don-t-copy-header-file-when-building.patch | 35 | ||||
-rw-r--r-- | dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-skip-execution-of-ElfPackager.patch | 44 | ||||
-rw-r--r-- | dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-IGC-VectorCompiler-CMakeLists.txt-link-to-external-L.patch | 47 | ||||
-rw-r--r-- | dynamic-layers/clang-layer/recipes-opencl/igc/files/0005-Temporary-LLVM-12-compatiblity-fix.patch | 2394 | ||||
-rw-r--r-- | dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.8744.bb (renamed from dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.8365.bb) | 32 |
6 files changed, 56 insertions, 2933 deletions
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch deleted file mode 100644 index b102af0f..00000000 --- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch +++ /dev/null | |||
@@ -1,437 +0,0 @@ | |||
1 | From 6247039d9193adf3813375fefc95071e8f5b4097 Mon Sep 17 00:00:00 2001 | ||
2 | From: Buildbot <buildbot@xenial.com> | ||
3 | Date: Fri, 27 Aug 2021 07:07:04 +0000 | ||
4 | Subject: [PATCH] LLVM 13 fixes | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> | ||
10 | Upstream-Status: Submitted | ||
11 | --- | ||
12 | .../LegalizeFunctionSignatures.cpp | 4 ++++ | ||
13 | IGC/AdaptorOCL/OCL/sp/spp_g8.cpp | 6 ++++- | ||
14 | IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 8 +++++++ | ||
15 | IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 8 +++++++ | ||
16 | IGC/Compiler/GenTTI.cpp | 4 ++++ | ||
17 | IGC/Compiler/GenTTI.h | 4 ++++ | ||
18 | IGC/Compiler/Optimizer/BuiltInFuncImport.cpp | 4 ++++ | ||
19 | IGC/Compiler/Optimizer/CodeAssumption.cpp | 5 ++++ | ||
20 | .../AddressSpaceAliasAnalysis.cpp | 23 +++++++++++++++++++ | ||
21 | .../PrivateMemory/PrivateMemoryResolution.cpp | 3 +++ | ||
22 | IGC/DebugInfo/DwarfDebug.cpp | 8 +++++++ | ||
23 | IGC/DebugInfo/StreamEmitter.cpp | 14 ++++++++++- | ||
24 | IGC/ElfPackager/main.cpp | 4 ++++ | ||
25 | .../BuiltinsFrontendDefinitions.hpp | 2 +- | ||
26 | .../lib/GenXCodeGen/GenXTargetMachine.h | 4 ++++ | ||
27 | .../include/llvmWrapper/Transforms/Scalar.h | 2 +- | ||
28 | IGC/common/LLVMUtils.cpp | 12 ++++++++++ | ||
29 | visa/iga/IGALibrary/IR/BitSet.hpp | 2 ++ | ||
30 | 18 files changed, 113 insertions(+), 4 deletions(-) | ||
31 | |||
32 | diff --git a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp | ||
33 | index ee43be301..395f26c91 100644 | ||
34 | --- a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp | ||
35 | +++ b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp | ||
36 | @@ -377,7 +377,11 @@ void LegalizeFunctionSignatures::FixFunctionBody(Module& M) | ||
37 | } | ||
38 | |||
39 | // Clone the old function body into the new | ||
40 | +#if LLVM_VERSION_MAJOR >= 13 | ||
41 | + CloneFunctionInto(pNewFunc, pFunc, VMap, CloneFunctionChangeType::DifferentModule, Returns); | ||
42 | +#else | ||
43 | CloneFunctionInto(pNewFunc, pFunc, VMap, true, Returns); | ||
44 | +#endif | ||
45 | |||
46 | // Merge the BB for when extra instructions were created | ||
47 | BasicBlock* ClonedEntryBB = cast<BasicBlock>(VMap[&*pFunc->begin()]); | ||
48 | diff --git a/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp b/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp | ||
49 | index 6f7c711bc..8d8c4e50d 100644 | ||
50 | --- a/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp | ||
51 | +++ b/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp | ||
52 | @@ -387,7 +387,11 @@ bool createElfFileName(std::string &name, unsigned int maxNameLen, SIMDMode simd | ||
53 | unsigned int mode = sys::fs::perms::all_read | sys::fs::perms::all_write; | ||
54 | // Every '%' will be replaced with a random character (0-9 or a-f), taking care of multithreaded compilations | ||
55 | if (std::error_code EC = sys::fs::createUniqueFile( | ||
56 | - uniqueLockFileName, uniqueLockFileID, resultUniqueLockFileName, mode)) | ||
57 | + uniqueLockFileName, uniqueLockFileID, resultUniqueLockFileName, | ||
58 | +#if LLVM_VERSION_MAJOR >= 13 | ||
59 | + llvm::sys::fs::OF_None, | ||
60 | +#endif | ||
61 | + mode)) | ||
62 | { | ||
63 | IGC_ASSERT_MESSAGE(false, "A uniquely named file not created"); | ||
64 | retValue = false; | ||
65 | diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | ||
66 | index 65e672afe..f28136a6a 100644 | ||
67 | --- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | ||
68 | +++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | ||
69 | @@ -97,7 +97,11 @@ isOpenCLKernel(SPIRVFunction *BF) { | ||
70 | __attr_unused static void | ||
71 | dumpLLVM(Module *M, const std::string &FName) { | ||
72 | std::error_code EC; | ||
73 | +#if LLVM_VERSION_MAJOR >= 13 | ||
74 | + raw_fd_ostream FS(FName, EC, sys::fs::OF_None); | ||
75 | +#else | ||
76 | raw_fd_ostream FS(FName, EC, sys::fs::F_None); | ||
77 | +#endif | ||
78 | if (!FS.has_error()) { | ||
79 | FS << *M; | ||
80 | } | ||
81 | @@ -2413,7 +2417,11 @@ SPIRVToLLVM::postProcessFunctionsReturnStruct(Function *F) { | ||
82 | NewArgIt->setName(OldArgIt->getName()); | ||
83 | VMap[&*OldArgIt] = &*NewArgIt; | ||
84 | } | ||
85 | +#if LLVM_VERSION_MAJOR >= 13 | ||
86 | + CloneFunctionInto(NewF, F, VMap, CloneFunctionChangeType::DifferentModule, Returns); | ||
87 | +#else | ||
88 | CloneFunctionInto(NewF, F, VMap, true, Returns); | ||
89 | +#endif | ||
90 | auto DL = M->getDataLayout(); | ||
91 | const auto ptrSize = DL.getPointerSize(); | ||
92 | |||
93 | diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | ||
94 | index ecb045b88..0a0893e4a 100644 | ||
95 | --- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | ||
96 | +++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | ||
97 | @@ -67,7 +67,11 @@ namespace igc_spv{ | ||
98 | void | ||
99 | saveLLVMModule(Module *M, const std::string &OutputFile) { | ||
100 | std::error_code EC; | ||
101 | +#if LLVM_VERSION_MAJOR >= 13 | ||
102 | + llvm::ToolOutputFile Out(OutputFile.c_str(), EC, sys::fs::OF_None); | ||
103 | +#else | ||
104 | llvm::ToolOutputFile Out(OutputFile.c_str(), EC, sys::fs::F_None); | ||
105 | +#endif | ||
106 | IGC_ASSERT_EXIT_MESSAGE((!EC), "Failed to open file"); | ||
107 | IGCLLVM::WriteBitcodeToFile(M, Out.os()); | ||
108 | Out.keep(); | ||
109 | @@ -326,7 +330,11 @@ mutateCallInst(Module *M, CallInst *CI, | ||
110 | } | ||
111 | } | ||
112 | |||
113 | +#if LLVM_VERSION_MAJOR >= 13 | ||
114 | + CloneFunctionInto(NewF, OldF, VMap, CloneFunctionChangeType::DifferentModule, Returns); | ||
115 | +#else | ||
116 | CloneFunctionInto(NewF, OldF, VMap, true, Returns); | ||
117 | +#endif | ||
118 | |||
119 | // Merge the basic block with Load instruction with the original entry basic block. | ||
120 | BasicBlock* ClonedEntryBB = cast<BasicBlock>(VMap[&*OldF->begin()]); | ||
121 | diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp | ||
122 | index 8a74ec287..23c9bc6ed 100644 | ||
123 | --- a/IGC/Compiler/GenTTI.cpp | ||
124 | +++ b/IGC/Compiler/GenTTI.cpp | ||
125 | @@ -461,7 +461,11 @@ namespace llvm { | ||
126 | // [LLVM-UPGRADE] moved from getCallCost to getUserCost | ||
127 | // https://github.com/llvm/llvm-project/commit/2641a19981e71c887bece92074e00d1af3e716c9#diff-dd4bd65dc55d754674d9a945a0d22911 | ||
128 | |||
129 | +#if LLVM_VERSION_MAJOR >= 13 | ||
130 | + InstructionCost GenIntrinsicsTTIImpl::getUserCost(const User *U, ArrayRef<const Value *> Operands, TTI::TargetCostKind CostKind) | ||
131 | +#else | ||
132 | int GenIntrinsicsTTIImpl::getUserCost(const User *U, ArrayRef<const Value *> Operands, TTI::TargetCostKind CostKind) | ||
133 | +#endif | ||
134 | { | ||
135 | const Function* F = dyn_cast<Function>(U); | ||
136 | if(F != nullptr) | ||
137 | diff --git a/IGC/Compiler/GenTTI.h b/IGC/Compiler/GenTTI.h | ||
138 | index bab1a5c4a..0b3bf4541 100644 | ||
139 | --- a/IGC/Compiler/GenTTI.h | ||
140 | +++ b/IGC/Compiler/GenTTI.h | ||
141 | @@ -71,8 +71,12 @@ namespace llvm | ||
142 | , const User * U | ||
143 | #endif | ||
144 | ); | ||
145 | +#else | ||
146 | +#if LLVM_VERSION_MAJOR >= 13 | ||
147 | + InstructionCost getUserCost(const User *U, ArrayRef<const Value *> Operands, | ||
148 | #else | ||
149 | int getUserCost(const User *U, ArrayRef<const Value *> Operands, | ||
150 | +#endif | ||
151 | TTI::TargetCostKind CostKind); | ||
152 | #endif | ||
153 | |||
154 | diff --git a/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp b/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp | ||
155 | index e7995ebb4..035bfba85 100644 | ||
156 | --- a/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp | ||
157 | +++ b/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp | ||
158 | @@ -880,7 +880,11 @@ void BIImport::removeFunctionBitcasts(Module& M) | ||
159 | pDstFunc, | ||
160 | funcTobeChanged, | ||
161 | operandMap, | ||
162 | +#if LLVM_VERSION_MAJOR >= 13 | ||
163 | + CloneFunctionChangeType::LocalChangesOnly, | ||
164 | +#else | ||
165 | false, | ||
166 | +#endif | ||
167 | Returns, | ||
168 | ""); | ||
169 | |||
170 | diff --git a/IGC/Compiler/Optimizer/CodeAssumption.cpp b/IGC/Compiler/Optimizer/CodeAssumption.cpp | ||
171 | index e7208a5fa..3ee9bddca 100644 | ||
172 | --- a/IGC/Compiler/Optimizer/CodeAssumption.cpp | ||
173 | +++ b/IGC/Compiler/Optimizer/CodeAssumption.cpp | ||
174 | @@ -272,7 +272,12 @@ bool CodeAssumption::addAssumption(Function* F, AssumptionCache* AC) | ||
175 | // Register assumption | ||
176 | if (AC) | ||
177 | { | ||
178 | +#if LLVM_VERSION_MAJOR >= 13 | ||
179 | + if (auto *aI = dyn_cast<AssumeInst>(assumeInst)) | ||
180 | + AC->registerAssumption(aI); | ||
181 | +#else | ||
182 | AC->registerAssumption(assumeInst); | ||
183 | +#endif | ||
184 | } | ||
185 | |||
186 | assumptionAdded[PN] = 1; | ||
187 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp | ||
188 | index a2b5927ea..1516e40e8 100644 | ||
189 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp | ||
190 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp | ||
191 | @@ -7,6 +7,9 @@ SPDX-License-Identifier: MIT | ||
192 | ============================= end_copyright_notice ===========================*/ | ||
193 | |||
194 | #include "llvm/Config/llvm-config.h" | ||
195 | +#if LLVM_VERSION_MAJOR >= 13 | ||
196 | +#include <llvm/Analysis/AliasAnalysis.h> | ||
197 | +#endif | ||
198 | #include <llvm/Analysis/TargetLibraryInfo.h> | ||
199 | #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h" | ||
200 | #include "Compiler/CodeGenPublic.h" | ||
201 | @@ -45,7 +48,11 @@ namespace { | ||
202 | PointerType* PtrTy2 = dyn_cast<PointerType>(LocB.Ptr->getType()); | ||
203 | |||
204 | if (!PtrTy1 || !PtrTy2) | ||
205 | +#if LLVM_VERSION_MAJOR >= 13 | ||
206 | + return AliasResult::Kind::NoAlias; | ||
207 | +#else | ||
208 | return NoAlias; | ||
209 | +#endif | ||
210 | |||
211 | unsigned AS1 = PtrTy1->getAddressSpace(); | ||
212 | unsigned AS2 = PtrTy2->getAddressSpace(); | ||
213 | @@ -62,21 +69,33 @@ namespace { | ||
214 | AS1 != ADDRESS_SPACE_GENERIC && | ||
215 | AS2 != ADDRESS_SPACE_GENERIC && | ||
216 | AS1 != AS2) | ||
217 | +#if LLVM_VERSION_MAJOR >= 13 | ||
218 | + return AliasResult::Kind::NoAlias; | ||
219 | +#else | ||
220 | return NoAlias; | ||
221 | +#endif | ||
222 | |||
223 | |||
224 | // Shared local memory doesn't alias any statefull memory. | ||
225 | if ((AS1 == ADDRESS_SPACE_LOCAL && AS2 > ADDRESS_SPACE_NUM_ADDRESSES) || | ||
226 | (AS1 > ADDRESS_SPACE_NUM_ADDRESSES && AS2 == ADDRESS_SPACE_LOCAL)) | ||
227 | { | ||
228 | +#if LLVM_VERSION_MAJOR >= 13 | ||
229 | + return AliasResult::Kind::NoAlias; | ||
230 | +#else | ||
231 | return NoAlias; | ||
232 | +#endif | ||
233 | } | ||
234 | |||
235 | // Private memory doesn't alias any stateful memory | ||
236 | if ((AS1 == ADDRESS_SPACE_PRIVATE && AS2 > ADDRESS_SPACE_NUM_ADDRESSES) || | ||
237 | (AS1 > ADDRESS_SPACE_NUM_ADDRESSES && AS2 == ADDRESS_SPACE_PRIVATE)) | ||
238 | { | ||
239 | +#if LLVM_VERSION_MAJOR >= 13 | ||
240 | + return AliasResult::Kind::NoAlias; | ||
241 | +#else | ||
242 | return NoAlias; | ||
243 | +#endif | ||
244 | } | ||
245 | |||
246 | |||
247 | @@ -108,7 +127,11 @@ namespace { | ||
248 | if ((resourceType[0] != resourceType[1]) || // different resource types | ||
249 | (isDirectAccess[0] && isDirectAccess[1] && resourceIndex[0] != resourceIndex[1])) // direct access to different BTIs | ||
250 | { | ||
251 | +#if LLVM_VERSION_MAJOR >= 13 | ||
252 | + return AliasResult::Kind::NoAlias; | ||
253 | +#else | ||
254 | return NoAlias; | ||
255 | +#endif | ||
256 | } | ||
257 | } | ||
258 | } | ||
259 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp | ||
260 | index 48c7e8637..8b9618284 100644 | ||
261 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp | ||
262 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp | ||
263 | @@ -17,6 +17,9 @@ SPDX-License-Identifier: MIT | ||
264 | #include "llvmWrapper/IR/DerivedTypes.h" | ||
265 | #include "llvm/Transforms/Utils/Local.h" | ||
266 | #include "llvm/IR/DataLayout.h" | ||
267 | +#if LLVM_VERSION_MAJOR >= 13 | ||
268 | +#include "llvm/IR/DebugInfo.h" | ||
269 | +#endif | ||
270 | #include "llvm/IR/DebugInfoMetadata.h" | ||
271 | #include "llvm/IR/Dominators.h" | ||
272 | #include "common/LLVMWarningsPop.hpp" | ||
273 | diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp | ||
274 | index f57dd72cb..d984fe86f 100644 | ||
275 | --- a/IGC/DebugInfo/DwarfDebug.cpp | ||
276 | +++ b/IGC/DebugInfo/DwarfDebug.cpp | ||
277 | @@ -857,9 +857,17 @@ CompileUnit* DwarfDebug::constructCompileUnit(DICompileUnit* DIUnit) | ||
278 | { | ||
279 | std::string str; | ||
280 | str = "Intel OpenCL "; | ||
281 | +#if LLVM_VERSION_MAJOR >= 13 | ||
282 | + str += toString(op1->getValue()->getUniqueInteger(), 10, false); | ||
283 | +#else | ||
284 | str += op1->getValue()->getUniqueInteger().toString(10, false); | ||
285 | +#endif | ||
286 | str += "."; | ||
287 | +#if LLVM_VERSION_MAJOR >= 13 | ||
288 | + str += toString(op2->getValue()->getUniqueInteger(), 10, false); | ||
289 | +#else | ||
290 | str += op2->getValue()->getUniqueInteger().toString(10, false); | ||
291 | +#endif | ||
292 | |||
293 | NewCU->addString(Die, dwarf::DW_AT_description, llvm::StringRef(str)); | ||
294 | } | ||
295 | diff --git a/IGC/DebugInfo/StreamEmitter.cpp b/IGC/DebugInfo/StreamEmitter.cpp | ||
296 | index a38a445d5..e9a5b6279 100644 | ||
297 | --- a/IGC/DebugInfo/StreamEmitter.cpp | ||
298 | +++ b/IGC/DebugInfo/StreamEmitter.cpp | ||
299 | @@ -391,11 +391,23 @@ StreamEmitter::StreamEmitter(raw_pwrite_stream& outStream, | ||
300 | |||
301 | MCRegisterInfo* regInfo = nullptr; | ||
302 | |||
303 | + Triple triple = Triple(GetTargetTriple()); | ||
304 | + | ||
305 | +#if LLVM_VERSION_MAJOR >= 13 | ||
306 | + // Create new MC context | ||
307 | + m_pContext = new MCContext(Triple(GetTargetTriple()), | ||
308 | + (const llvm::MCAsmInfo*)m_pAsmInfo, regInfo, | ||
309 | + /*MSTI=*/(const llvm::MCSubtargetInfo *)nullptr, m_pSrcMgr); | ||
310 | + | ||
311 | + m_pObjFileInfo->initMCObjectFileInfo(*m_pContext, false); | ||
312 | + | ||
313 | + m_pContext->setObjectFileInfo(m_pObjFileInfo); | ||
314 | +#else | ||
315 | // Create new MC context | ||
316 | m_pContext = new MCContext((const llvm::MCAsmInfo*)m_pAsmInfo, regInfo, m_pObjFileInfo, m_pSrcMgr); | ||
317 | |||
318 | - Triple triple = Triple(GetTargetTriple()); | ||
319 | m_pObjFileInfo->InitMCObjectFileInfo(Triple(GetTargetTriple()), false, *m_pContext); | ||
320 | +#endif | ||
321 | |||
322 | bool is64Bit = GetPointerSize() == 8; | ||
323 | uint8_t osABI = MCELFObjectTargetWriter::getOSABI(triple.getOS()); | ||
324 | diff --git a/IGC/ElfPackager/main.cpp b/IGC/ElfPackager/main.cpp | ||
325 | index 38a5001c1..5f4d87d96 100644 | ||
326 | --- a/IGC/ElfPackager/main.cpp | ||
327 | +++ b/IGC/ElfPackager/main.cpp | ||
328 | @@ -177,7 +177,11 @@ std::unique_ptr<IGCLLVM::Module> LocalCloneModule( | ||
329 | } | ||
330 | |||
331 | SmallVector<ReturnInst*, 8> Returns; // Ignore returns cloned. | ||
332 | +#if LLVM_VERSION_MAJOR >= 13 | ||
333 | + CloneFunctionInto(F, &*I, VMap, CloneFunctionChangeType::DifferentModule, Returns); | ||
334 | +#else | ||
335 | CloneFunctionInto(F, &*I, VMap, /*ModuleLevelChanges=*/true, Returns); | ||
336 | +#endif | ||
337 | } | ||
338 | |||
339 | if (I->hasPersonalityFn()) | ||
340 | diff --git a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp | ||
341 | index b5f66f048..568b42c07 100644 | ||
342 | --- a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp | ||
343 | +++ b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp | ||
344 | @@ -5028,7 +5028,7 @@ llvm::Value* LLVM3DBuilder<preserveNames, T, Inserter>::ScalarsToVector( | ||
345 | IGC_ASSERT(nullptr != resultType); | ||
346 | llvm::Value* result = llvm::UndefValue::get(resultType); | ||
347 | |||
348 | - for (unsigned i = 0; i < llvm::cast<llvm::VectorType>(resultType)->getNumElements(); i++) | ||
349 | + for (unsigned i = 0; i < llvm::cast<IGCLLVM::FixedVectorType>(resultType)->getNumElements(); i++) | ||
350 | { | ||
351 | IGC_ASSERT(nullptr != scalars[i]); | ||
352 | IGC_ASSERT(llvm::cast<llvm::VectorType>(resultType)->getElementType() == scalars[i]->getType()); | ||
353 | diff --git a/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h b/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h | ||
354 | index f90bc1bc0..8ce06e93f 100644 | ||
355 | --- a/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h | ||
356 | +++ b/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h | ||
357 | @@ -97,7 +97,11 @@ public: | ||
358 | bool shouldBuildLookupTables() { return false; } | ||
359 | unsigned getFlatAddressSpace() { return 4; } | ||
360 | |||
361 | +#if LLVM_VERSION_MAJOR >= 13 | ||
362 | + InstructionCost getUserCost(const User *U, ArrayRef<const Value *> Operands | ||
363 | +#else | ||
364 | int getUserCost(const User *U, ArrayRef<const Value *> Operands | ||
365 | +#endif | ||
366 | #if LLVM_VERSION_MAJOR >= 11 | ||
367 | , | ||
368 | TTI::TargetCostKind CostKind | ||
369 | diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h | ||
370 | index 1df041372..022141d15 100644 | ||
371 | --- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h | ||
372 | +++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h | ||
373 | @@ -26,7 +26,7 @@ namespace IGCLLVM | ||
374 | { | ||
375 | return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling); | ||
376 | } | ||
377 | -#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 12 | ||
378 | +#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 13 | ||
379 | inline static llvm::Pass * createLoopUnrollPass( | ||
380 | int OptLevel = 2, int Threshold = -1, int Count = -1, | ||
381 | int AllowPartial = -1, int Runtime = -1, | ||
382 | diff --git a/IGC/common/LLVMUtils.cpp b/IGC/common/LLVMUtils.cpp | ||
383 | index ed2cfc413..ae9df5d63 100644 | ||
384 | --- a/IGC/common/LLVMUtils.cpp | ||
385 | +++ b/IGC/common/LLVMUtils.cpp | ||
386 | @@ -132,7 +132,11 @@ bool IGCPassManager::isInList(const StringRef& N, const StringRef& List) const | ||
387 | size_t endPos = List.find_first_of(Separators, startPos); | ||
388 | size_t len = (endPos != StringRef::npos ? endPos - startPos : endPos); | ||
389 | StringRef Name = List.substr(startPos, len); | ||
390 | +#if LLVM_VERSION_MAJOR >= 13 | ||
391 | + if (Name.equals_insensitive(N)) | ||
392 | +#else | ||
393 | if (Name.equals_lower(N)) | ||
394 | +#endif | ||
395 | { | ||
396 | return true; | ||
397 | } | ||
398 | @@ -149,7 +153,11 @@ bool IGCPassManager::isPrintBefore(Pass* P) | ||
399 | // or pass command args registered in passInfo. | ||
400 | StringRef passNameList(IGC_GET_REGKEYSTRING(PrintBefore)); | ||
401 | StringRef PN = P->getPassName(); | ||
402 | +#if LLVM_VERSION_MAJOR >= 13 | ||
403 | + if (passNameList.equals_insensitive("all") || isInList(PN, passNameList)) | ||
404 | +#else | ||
405 | if (passNameList.equals_lower("all") || isInList(PN, passNameList)) | ||
406 | +#endif | ||
407 | return true; | ||
408 | |||
409 | // further check passInfo | ||
410 | @@ -173,7 +181,11 @@ bool IGCPassManager::isPrintAfter(Pass* P) | ||
411 | // or pass command args registered in passInfo. | ||
412 | StringRef passNameList(IGC_GET_REGKEYSTRING(PrintAfter)); | ||
413 | StringRef PN = P->getPassName(); | ||
414 | +#if LLVM_VERSION_MAJOR >= 13 | ||
415 | + if (passNameList.equals_insensitive("all") || isInList(PN, passNameList)) | ||
416 | +#else | ||
417 | if (passNameList.equals_lower("all") || isInList(PN, passNameList)) | ||
418 | +#endif | ||
419 | return true; | ||
420 | |||
421 | // further check passInfo | ||
422 | diff --git a/visa/iga/IGALibrary/IR/BitSet.hpp b/visa/iga/IGALibrary/IR/BitSet.hpp | ||
423 | index 43b0d3f92..c6cdd430a 100644 | ||
424 | --- a/visa/iga/IGALibrary/IR/BitSet.hpp | ||
425 | +++ b/visa/iga/IGALibrary/IR/BitSet.hpp | ||
426 | @@ -12,6 +12,8 @@ SPDX-License-Identifier: MIT | ||
427 | #include "../asserts.hpp" | ||
428 | #include "common/secure_mem.h" | ||
429 | |||
430 | +#include <stdexcept> | ||
431 | +#include <limits> | ||
432 | #include <algorithm> | ||
433 | #include <bitset> | ||
434 | #include <cstdint> | ||
435 | -- | ||
436 | 2.31.1 | ||
437 | |||
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-llvm_deps.cmake-don-t-copy-header-file-when-building.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-llvm_deps.cmake-don-t-copy-header-file-when-building.patch new file mode 100644 index 00000000..d62f47ca --- /dev/null +++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-llvm_deps.cmake-don-t-copy-header-file-when-building.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From 3d99559779d628704568879a2ee51e968e66d005 Mon Sep 17 00:00:00 2001 | ||
2 | From: Anuj Mittal <anuj.mittal@intel.com> | ||
3 | Date: Tue, 5 Oct 2021 00:11:26 +0800 | ||
4 | Subject: [PATCH] llvm_deps.cmake: don't copy header file when building | ||
5 | |||
6 | We build in pre-built mode and this header shouldn't be copied in | ||
7 | that case. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> | ||
12 | --- | ||
13 | external/llvm/llvm_deps.cmake | 6 +++--- | ||
14 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
15 | |||
16 | diff --git a/external/llvm/llvm_deps.cmake b/external/llvm/llvm_deps.cmake | ||
17 | index 425d3766f..e43804f77 100644 | ||
18 | --- a/external/llvm/llvm_deps.cmake | ||
19 | +++ b/external/llvm/llvm_deps.cmake | ||
20 | @@ -46,9 +46,9 @@ if(IGC_OPTION__LLVM_LLD) | ||
21 | include(llvm_lld_source_hook) | ||
22 | if(NOT EXISTS "${IGC_LLVM_WORKSPACE_SRC}/libunwind/include/mach-o" AND ${IGC_OPTION__LLVM_PREFERRED_VERSION} GREATER_EQUAL "12.0.0") | ||
23 | # Need to copy one header from unwind package for LLD (only for building from sources) | ||
24 | - file(MAKE_DIRECTORY ${IGC_LLVM_WORKSPACE_SRC}/libunwind/include/mach-o) | ||
25 | - file(COPY ${DEFAULT_IGC_LLVM_SOURCES_DIR}/libunwind/include/mach-o/compact_unwind_encoding.h | ||
26 | - DESTINATION ${IGC_LLVM_WORKSPACE_SRC}/libunwind/include/mach-o/) | ||
27 | + #file(MAKE_DIRECTORY ${IGC_LLVM_WORKSPACE_SRC}/libunwind/include/mach-o) | ||
28 | + #file(COPY ${DEFAULT_IGC_LLVM_SOURCES_DIR}/libunwind/include/mach-o/compact_unwind_encoding.h | ||
29 | + # DESTINATION ${IGC_LLVM_WORKSPACE_SRC}/libunwind/include/mach-o/) | ||
30 | endif() | ||
31 | endif() | ||
32 | |||
33 | -- | ||
34 | 2.32.0 | ||
35 | |||
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-skip-execution-of-ElfPackager.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-skip-execution-of-ElfPackager.patch deleted file mode 100644 index b77823b8..00000000 --- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-skip-execution-of-ElfPackager.patch +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | From 562a19fe7ef3f4732365efdfc6d2a30763a5b8b0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Dongwon Kim <dongwon.kim@intel.com> | ||
3 | Date: Wed, 18 Aug 2021 18:49:49 -0700 | ||
4 | Subject: [PATCH 1/5] skip execution of ElfPackager | ||
5 | |||
6 | ElfPackager adds the ability to convert llvm bitcode into elf files for | ||
7 | easier partitioning. Skip for now until we start building a native | ||
8 | version for this. | ||
9 | |||
10 | Upstream-Status: Inappropriate [configuration specific] | ||
11 | |||
12 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> | ||
13 | Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> | ||
14 | Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> | ||
15 | --- | ||
16 | IGC/ElfPackager/CMakeLists.txt | 12 ++++++------ | ||
17 | 1 file changed, 6 insertions(+), 6 deletions(-) | ||
18 | |||
19 | diff --git a/IGC/ElfPackager/CMakeLists.txt b/IGC/ElfPackager/CMakeLists.txt | ||
20 | index 8959a3ebb..7c3a0b42f 100644 | ||
21 | --- a/IGC/ElfPackager/CMakeLists.txt | ||
22 | +++ b/IGC/ElfPackager/CMakeLists.txt | ||
23 | @@ -51,12 +51,12 @@ if(NOT TARGET ${IGC_BUILD__PROJ__ElfPackager}) | ||
24 | ${IGC_SOURCE_DIR}/AdaptorOCL/CLElfLib/ | ||
25 | ) | ||
26 | |||
27 | - if(NOT ANDROID) | ||
28 | - add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager} | ||
29 | - POST_BUILD | ||
30 | - COMMAND $<TARGET_FILE:${IGC_BUILD__PROJ__ElfPackager}> -includeSizet -funcList ${CMAKE_CURRENT_SOURCE_DIR}/function_bin.txt ${IGC_BUILD__BIF_DIR}/OCLBiFImpl.bc ${IGC_BUILD__BIF_DIR}/igdclbif.bin | ||
31 | - ) | ||
32 | - endif() | ||
33 | +# if(NOT ANDROID) | ||
34 | +# add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager} | ||
35 | +# POST_BUILD | ||
36 | +# COMMAND $<TARGET_FILE:${IGC_BUILD__PROJ__ElfPackager}> -includeSizet -funcList ${CMAKE_CURRENT_SOURCE_DIR}/function_bin.txt ${IGC_BUILD__BIF_DIR}/OCLBiFImpl.bc ${IGC_BUILD__BIF_DIR}/igdclbif.bin | ||
37 | +# ) | ||
38 | +# endif() | ||
39 | |||
40 | |||
41 | add_dependencies("${IGC_BUILD__PROJ__ElfPackager}" "${IGC_BUILD__PROJ__BiFModule_OCL}") | ||
42 | -- | ||
43 | 2.20.1 | ||
44 | |||
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-IGC-VectorCompiler-CMakeLists.txt-link-to-external-L.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-IGC-VectorCompiler-CMakeLists.txt-link-to-external-L.patch deleted file mode 100644 index db834c99..00000000 --- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-IGC-VectorCompiler-CMakeLists.txt-link-to-external-L.patch +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | From 92a663dd55917fdfad5ae4daa173a9d18df0ee9e Mon Sep 17 00:00:00 2001 | ||
2 | From: Dongwon Kim <dongwon.kim@intel.com> | ||
3 | Date: Wed, 18 Aug 2021 19:14:28 -0700 | ||
4 | Subject: [PATCH 2/5] IGC/VectorCompiler/CMakeLists.txt: link to external | ||
5 | LLVMGenXIntrinsics | ||
6 | |||
7 | By default LLVMGenXIntrinsics is to be build In-tree, but we want to | ||
8 | link externally. | ||
9 | |||
10 | Upstream-Status: Inappropriate [configuration specific] | ||
11 | |||
12 | Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> | ||
13 | Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> | ||
14 | --- | ||
15 | IGC/VectorCompiler/CMakeLists.txt | 16 ---------------- | ||
16 | 1 file changed, 16 deletions(-) | ||
17 | |||
18 | diff --git a/IGC/VectorCompiler/CMakeLists.txt b/IGC/VectorCompiler/CMakeLists.txt | ||
19 | index 0b26072f0..bf1cd939d 100644 | ||
20 | --- a/IGC/VectorCompiler/CMakeLists.txt | ||
21 | +++ b/IGC/VectorCompiler/CMakeLists.txt | ||
22 | @@ -43,22 +43,6 @@ if(LLVM_ON_WIN32) | ||
23 | endif() | ||
24 | |||
25 | # --- VC Intrinsics --- | ||
26 | - | ||
27 | -if(DEFINED VC_INTRINSICS_SRC) | ||
28 | - set(INTRSRC "${VC_INTRINSICS_SRC}/GenXIntrinsics") | ||
29 | -endif() | ||
30 | - | ||
31 | -if(NOT DEFINED INTRSRC) | ||
32 | - set(INTRSRC "${CMAKE_CURRENT_SOURCE_DIR}/../../../vc-intrinsics/GenXIntrinsics") | ||
33 | -endif() | ||
34 | - | ||
35 | -message(STATUS "[VC] Using vc-intrinsics source from: ${INTRSRC}") | ||
36 | -# Trick intrinsics. | ||
37 | -set(BUILD_EXTERNAL YES) | ||
38 | -# We are using prebuilt SPIRV and building intrinsics. | ||
39 | -set(INTRBUILD "${CMAKE_CURRENT_BINARY_DIR}/intrbuild") | ||
40 | -add_subdirectory(${INTRSRC} ${INTRBUILD} EXCLUDE_FROM_ALL) | ||
41 | - | ||
42 | include(cmake/spirv.cmake) | ||
43 | |||
44 | set(IGC_OPTION__VC_DISABLE_BIF_DEFAULT OFF) | ||
45 | -- | ||
46 | 2.20.1 | ||
47 | |||
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0005-Temporary-LLVM-12-compatiblity-fix.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0005-Temporary-LLVM-12-compatiblity-fix.patch deleted file mode 100644 index 000595a9..00000000 --- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0005-Temporary-LLVM-12-compatiblity-fix.patch +++ /dev/null | |||
@@ -1,2394 +0,0 @@ | |||
1 | From 2207600aa9ddf8be1796bcc4667bc0a3b60aef03 Mon Sep 17 00:00:00 2001 | ||
2 | From: Dongwon Kim <dongwon.kim@intel.com> | ||
3 | Date: Thu, 19 Aug 2021 20:09:23 -0700 | ||
4 | Subject: [PATCH 5/5] Temporary LLVM 12 compatiblity fix | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Upstream-Status: Submitted | ||
10 | |||
11 | Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> | ||
12 | Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> | ||
13 | Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> | ||
14 | --- | ||
15 | .../LegalizeFunctionSignatures.cpp | 2 +- | ||
16 | IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 22 +++++----- | ||
17 | IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 4 +- | ||
18 | IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | 3 +- | ||
19 | IGC/Compiler/CISACodeGen/CShader.cpp | 14 +++---- | ||
20 | .../CISACodeGen/ConstantCoalescing.cpp | 14 +++---- | ||
21 | IGC/Compiler/CISACodeGen/DeSSA.cpp | 5 ++- | ||
22 | IGC/Compiler/CISACodeGen/EmitVISAPass.cpp | 42 +++++++++---------- | ||
23 | IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp | 4 +- | ||
24 | IGC/Compiler/CISACodeGen/GenIRLowering.cpp | 4 +- | ||
25 | .../CISACodeGen/GenSimplification.cpp | 5 ++- | ||
26 | .../CISACodeGen/GeometryShaderLowering.cpp | 3 +- | ||
27 | IGC/Compiler/CISACodeGen/LdShrink.cpp | 10 +++-- | ||
28 | .../CISACodeGen/LowerGEPForPrivMem.cpp | 8 ++-- | ||
29 | IGC/Compiler/CISACodeGen/MemOpt.cpp | 8 ++-- | ||
30 | IGC/Compiler/CISACodeGen/MemOpt2.cpp | 5 ++- | ||
31 | .../CISACodeGen/OpenCLKernelCodeGen.cpp | 2 +- | ||
32 | IGC/Compiler/CISACodeGen/PatternMatchPass.cpp | 6 +-- | ||
33 | IGC/Compiler/CISACodeGen/PushAnalysis.cpp | 4 +- | ||
34 | .../CISACodeGen/RegisterEstimator.cpp | 3 +- | ||
35 | .../CISACodeGen/RegisterPressureEstimate.hpp | 3 +- | ||
36 | IGC/Compiler/CISACodeGen/SLMConstProp.cpp | 3 +- | ||
37 | .../CISACodeGen/ScalarizerCodeGen.cpp | 4 +- | ||
38 | IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp | 4 ++ | ||
39 | .../CISACodeGen/Simd32Profitability.cpp | 10 +++-- | ||
40 | IGC/Compiler/CISACodeGen/SimplifyConstant.cpp | 12 +++--- | ||
41 | IGC/Compiler/CISACodeGen/TypeDemote.cpp | 3 +- | ||
42 | .../CISACodeGen/VariableReuseAnalysis.cpp | 5 ++- | ||
43 | .../CISACodeGen/VariableReuseAnalysis.hpp | 3 +- | ||
44 | IGC/Compiler/CISACodeGen/VectorPreProcess.cpp | 24 +++++------ | ||
45 | IGC/Compiler/CISACodeGen/VectorProcess.cpp | 4 +- | ||
46 | IGC/Compiler/CISACodeGen/helper.cpp | 10 ++--- | ||
47 | IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | 7 ++-- | ||
48 | IGC/Compiler/CustomSafeOptPass.cpp | 26 ++++++------ | ||
49 | IGC/Compiler/DebugInfo/ScalarVISAModule.cpp | 3 +- | ||
50 | IGC/Compiler/GenTTI.cpp | 3 +- | ||
51 | IGC/Compiler/GenUpdateCB.cpp | 3 +- | ||
52 | IGC/Compiler/HandleFRemInstructions.cpp | 3 +- | ||
53 | IGC/Compiler/HandleLoadStoreInstructions.cpp | 4 +- | ||
54 | IGC/Compiler/LegalizationPass.cpp | 28 ++++++------- | ||
55 | IGC/Compiler/Legalizer/InstPromoter.cpp | 2 +- | ||
56 | IGC/Compiler/Legalizer/InstScalarizer.cpp | 6 +-- | ||
57 | .../Legalizer/PeepholeTypeLegalizer.cpp | 6 +-- | ||
58 | IGC/Compiler/Legalizer/TypeLegalizer.cpp | 3 +- | ||
59 | IGC/Compiler/Legalizer/TypeLegalizer.h | 3 +- | ||
60 | IGC/Compiler/LowPrecisionOptPass.cpp | 2 +- | ||
61 | .../AddressSpaceAliasAnalysis.cpp | 1 + | ||
62 | .../AggregateArguments/AggregateArguments.cpp | 3 +- | ||
63 | .../CorrectlyRoundedDivSqrt.cpp | 3 +- | ||
64 | .../DeviceEnqueueFuncs/TransformBlocks.cpp | 4 +- | ||
65 | .../Optimizer/OpenCLPasses/KernelArgs.cpp | 3 +- | ||
66 | .../OpenCLPrintf/OpenCLPrintfResolution.cpp | 4 +- | ||
67 | .../PrivateMemory/PrivateMemoryResolution.cpp | 6 +-- | ||
68 | .../ReplaceUnsupportedIntrinsics.cpp | 4 +- | ||
69 | .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp | 2 +- | ||
70 | .../Optimizer/PreCompiledFuncImport.cpp | 4 +- | ||
71 | IGC/Compiler/Optimizer/Scalarizer.cpp | 32 +++++++------- | ||
72 | IGC/Compiler/Optimizer/ValueTracker.cpp | 2 +- | ||
73 | IGC/Compiler/VerificationPass.cpp | 2 +- | ||
74 | IGC/DebugInfo/DebugInfoUtils.hpp | 2 +- | ||
75 | IGC/DebugInfo/DwarfDebug.cpp | 4 +- | ||
76 | IGC/GenISAIntrinsics/GenIntrinsics.cpp | 6 +-- | ||
77 | .../BuiltinsFrontendDefinitions.hpp | 2 +- | ||
78 | .../include/llvmWrapper/IR/DerivedTypes.h | 10 +++++ | ||
79 | .../include/llvmWrapper/Support/TypeSize.h | 6 ++- | ||
80 | .../include/llvmWrapper/Transforms/Scalar.h | 4 +- | ||
81 | .../llvmWrapper/Transforms/Utils/LoopUtils.h | 8 ++++ | ||
82 | IGC/common/igc_resourceDimTypes.h | 6 ++- | ||
83 | 68 files changed, 263 insertions(+), 207 deletions(-) | ||
84 | |||
85 | diff --git a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp | ||
86 | index d06c26de4..ee43be301 100644 | ||
87 | --- a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp | ||
88 | +++ b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp | ||
89 | @@ -133,7 +133,7 @@ inline Type* LegalizedIntVectorType(Module& M, Type* ty) | ||
90 | |||
91 | return ty->isIntegerTy() ? | ||
92 | cast<Type>(IntegerType::get(M.getContext(), newSize)) : | ||
93 | - IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<VectorType>(ty)->getNumElements()); | ||
94 | + IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<IGCLLVM::FixedVectorType>(ty)->getNumElements()); | ||
95 | } | ||
96 | |||
97 | // Returns true for small structures that only contain primitive types | ||
98 | diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | ||
99 | index 66f31a0ce..65e672afe 100644 | ||
100 | --- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | ||
101 | +++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | ||
102 | @@ -1610,7 +1610,7 @@ void SPIRVToLLVMDbgTran::transDbgInfo(SPIRVValue *SV, Value *V) { | ||
103 | Line->getColumn(), scope, iat); | ||
104 | |||
105 | if(scope && !isa<DIFile>(scope)) | ||
106 | - I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(), | ||
107 | + I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(), | ||
108 | scope, iat)); | ||
109 | } | ||
110 | } | ||
111 | @@ -2063,7 +2063,7 @@ SPIRVToLLVM::transType(SPIRVType *T) { | ||
112 | auto name = isSubgroupAvcINTELTypeOpCode(OC) ? | ||
113 | OCLSubgroupINTELTypeOpCodeMap::rmap(OC) : | ||
114 | BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC); | ||
115 | - auto *pST = M->getTypeByName(name); | ||
116 | + auto *pST = IGCLLVM::getTypeByName(M, name); | ||
117 | pST = pST ? pST : StructType::create(*Context, name); | ||
118 | |||
119 | return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC))); | ||
120 | @@ -2541,7 +2541,7 @@ Value *SPIRVToLLVM::promoteBool(Value *pVal, BasicBlock *BB) | ||
121 | |||
122 | auto *PromoType = isa<VectorType>(pVal->getType()) ? | ||
123 | cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt8Ty(pVal->getContext()), | ||
124 | - (unsigned)cast<VectorType>(pVal->getType())->getNumElements())) : | ||
125 | + (unsigned)cast<IGCLLVM::FixedVectorType>(pVal->getType())->getNumElements())) : | ||
126 | Type::getInt8Ty(pVal->getContext()); | ||
127 | |||
128 | if (auto *C = dyn_cast<Constant>(pVal)) | ||
129 | @@ -2583,7 +2583,7 @@ Value *SPIRVToLLVM::truncBool(Value *pVal, BasicBlock *BB) | ||
130 | |||
131 | auto *TruncType = isa<VectorType>(pVal->getType()) ? | ||
132 | cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(pVal->getContext()), | ||
133 | - (unsigned)cast<VectorType>(pVal->getType())->getNumElements())) : | ||
134 | + (unsigned)cast<IGCLLVM::FixedVectorType>(pVal->getType())->getNumElements())) : | ||
135 | Type::getInt1Ty(pVal->getContext()); | ||
136 | |||
137 | if (auto *C = dyn_cast<Constant>(pVal)) | ||
138 | @@ -2629,7 +2629,7 @@ Type *SPIRVToLLVM::truncBoolType(SPIRVType *SPVType, Type *LLType) | ||
139 | |||
140 | return isa<VectorType>(LLType) ? | ||
141 | cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(LLType->getContext()), | ||
142 | - (unsigned)cast<VectorType>(LLType)->getNumElements())) : | ||
143 | + (unsigned)cast<IGCLLVM::FixedVectorType>(LLType)->getNumElements())) : | ||
144 | Type::getInt1Ty(LLType->getContext()); | ||
145 | } | ||
146 | |||
147 | @@ -2837,7 +2837,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F, | ||
148 | { | ||
149 | if(CV[i]->getType()->isVectorTy()) | ||
150 | { | ||
151 | - for(uint32_t j = 0; j < cast<VectorType>(CV[i]->getType())->getNumElements(); j++) | ||
152 | + for(uint32_t j = 0; j < cast<IGCLLVM::FixedVectorType>(CV[i]->getType())->getNumElements(); j++) | ||
153 | { | ||
154 | Value *v = ExtractElementInst::Create( CV[i],ConstantInt::get( *Context,APInt( 32,j ) ),BCC->getName(),BB ); | ||
155 | elm1 = CreateCompositeConstruct( elm1,v,pos++ ); | ||
156 | @@ -3508,7 +3508,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F, | ||
157 | auto Vector = transValue(BI->getOperand(0), F, BB); | ||
158 | auto Scalar = transValue(BI->getOperand(1), F, BB); | ||
159 | |||
160 | - auto VecType = cast<VectorType>(Vector->getType()); | ||
161 | + auto VecType = cast<IGCLLVM::FixedVectorType>(Vector->getType()); | ||
162 | auto Undef = UndefValue::get(VecType); | ||
163 | |||
164 | auto ScalarVec = InsertElementInst::Create(Undef, Scalar, | ||
165 | @@ -3533,7 +3533,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F, | ||
166 | a->getType()->getScalarSizeInBits() - 1); | ||
167 | auto *ShiftOp = isa<VectorType>(a->getType()) ? | ||
168 | ConstantVector::getSplat( | ||
169 | - IGCLLVM::getElementCount((unsigned)cast<VectorType>(a->getType())->getNumElements()), ShiftAmt) : | ||
170 | + IGCLLVM::getElementCount((unsigned)cast<IGCLLVM::FixedVectorType>(a->getType())->getNumElements()), ShiftAmt) : | ||
171 | ShiftAmt; | ||
172 | |||
173 | // OCL C: | ||
174 | @@ -3887,15 +3887,15 @@ SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI, BasicBlock *BB) { | ||
175 | "", | ||
176 | BB); | ||
177 | } | ||
178 | - else if (cast<VectorType>(coordType)->getNumElements() != 4) | ||
179 | + else if (cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements() != 4) | ||
180 | { | ||
181 | Value *undef = UndefValue::get(coordType); | ||
182 | |||
183 | SmallVector<Constant*, 4> shuffleIdx; | ||
184 | - for (unsigned i = 0; i < cast<VectorType>(coordType)->getNumElements(); i++) | ||
185 | + for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements(); i++) | ||
186 | shuffleIdx.push_back(ConstantInt::get(Type::getInt32Ty(*Context), i)); | ||
187 | |||
188 | - for (uint64_t i = (unsigned)cast<VectorType>(coordType)->getNumElements(); i < 4; i++) | ||
189 | + for (uint64_t i = (unsigned)cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements(); i < 4; i++) | ||
190 | shuffleIdx.push_back(ConstantInt::get(Type::getInt32Ty(*Context), 0)); | ||
191 | |||
192 | imageCoordinateWiden = new ShuffleVectorInst( | ||
193 | diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | ||
194 | index 73ffca030..ecb045b88 100644 | ||
195 | --- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | ||
196 | +++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | ||
197 | @@ -76,7 +76,7 @@ saveLLVMModule(Module *M, const std::string &OutputFile) { | ||
198 | PointerType* | ||
199 | getOrCreateOpaquePtrType(Module *M, const std::string &Name, | ||
200 | unsigned AddrSpace) { | ||
201 | - auto OpaqueType = M->getTypeByName(Name); | ||
202 | + auto OpaqueType = IGCLLVM::getTypeByName(M, Name); | ||
203 | if (!OpaqueType) | ||
204 | OpaqueType = StructType::create(M->getContext(), Name); | ||
205 | return PointerType::get(OpaqueType, AddrSpace); | ||
206 | @@ -142,7 +142,7 @@ std::string recursive_mangle(const Type* pType) | ||
207 | return "i" + utostr(pType->getIntegerBitWidth()); | ||
208 | case IGCLLVM::VectorTyID: | ||
209 | { | ||
210 | - unsigned vecLen = (unsigned)cast<VectorType>(pType)->getNumElements(); | ||
211 | + unsigned vecLen = (unsigned)cast<IGCLLVM::FixedVectorType>(pType)->getNumElements(); | ||
212 | Type* pEltType = cast<VectorType>(pType)->getElementType(); | ||
213 | return "v" + utostr(vecLen) + recursive_mangle(pEltType); | ||
214 | } | ||
215 | diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | ||
216 | index 876cb0a30..9621c4d53 100644 | ||
217 | --- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | ||
218 | +++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | ||
219 | @@ -17,6 +17,7 @@ SPDX-License-Identifier: MIT | ||
220 | #include <llvm/Support/Debug.h> | ||
221 | #include <llvm/Support/raw_ostream.h> | ||
222 | #include <llvm/Transforms/Utils/Local.h> | ||
223 | +#include "llvmWrapper/Transforms/Utils/LoopUtils.h" | ||
224 | #include "common/LLVMWarningsPop.hpp" | ||
225 | #include "GenISAIntrinsics/GenIntrinsics.h" | ||
226 | #include "Compiler/CISACodeGen/ShaderCodeGen.hpp" | ||
227 | @@ -118,7 +119,7 @@ bool AdvMemOpt::runOnFunction(Function& F) { | ||
228 | for (auto I = LI->begin(), E = LI->end(); I != E; ++I) | ||
229 | for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) { | ||
230 | Loop* L = *DFI; | ||
231 | - if (L->empty()) | ||
232 | + if (IGCLLVM::isInnermost(L)) | ||
233 | InnermostLoops.push_back(L); | ||
234 | } | ||
235 | |||
236 | diff --git a/IGC/Compiler/CISACodeGen/CShader.cpp b/IGC/Compiler/CISACodeGen/CShader.cpp | ||
237 | index 04b59cf00..16b77b050 100644 | ||
238 | --- a/IGC/Compiler/CISACodeGen/CShader.cpp | ||
239 | +++ b/IGC/Compiler/CISACodeGen/CShader.cpp | ||
240 | @@ -427,7 +427,7 @@ void CShader::CreateAliasVars() | ||
241 | continue; | ||
242 | |||
243 | Type* Ty = V->getType(); | ||
244 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
245 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
246 | Type* BTy = VTy ? VTy->getElementType() : Ty; | ||
247 | int nelts = (VTy ? (int)VTy->getNumElements() : 1); | ||
248 | |||
249 | @@ -1039,7 +1039,7 @@ bool CShader::InsideWorkgroupDivergentCF(const llvm::Instruction* inst) const | ||
250 | uint CShader::GetNbVectorElementAndMask(llvm::Value* val, uint32_t& mask) | ||
251 | { | ||
252 | llvm::Type* type = val->getType(); | ||
253 | - uint nbElement = int_cast<uint>(cast<VectorType>(type)->getNumElements()); | ||
254 | + uint nbElement = int_cast<uint>(cast<IGCLLVM::FixedVectorType>(type)->getNumElements()); | ||
255 | mask = 0; | ||
256 | // we don't process vector bigger than 31 elements as the mask has only 32bits | ||
257 | // If we want to support longer vectors we need to extend the mask size | ||
258 | @@ -1244,7 +1244,7 @@ CShader::ExtractMaskWrapper::ExtractMaskWrapper(CShader* pS, Value* VecVal) | ||
259 | m_EM = it->second; | ||
260 | return; | ||
261 | } | ||
262 | - VectorType* VTy = dyn_cast<VectorType>(VecVal->getType()); | ||
263 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(VecVal->getType()); | ||
264 | const unsigned int numChannels = VTy ? (unsigned)VTy->getNumElements() : 1; | ||
265 | if (numChannels <= 32) | ||
266 | { | ||
267 | @@ -1768,7 +1768,7 @@ CVariable* CShader::GetStructVariable(llvm::Value* v, bool forceVectorInit) | ||
268 | |||
269 | CVariable* CShader::GetConstant(llvm::Constant* C, CVariable* dstVar) | ||
270 | { | ||
271 | - llvm::VectorType* VTy = llvm::dyn_cast<llvm::VectorType>(C->getType()); | ||
272 | + IGCLLVM::FixedVectorType* VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(C->getType()); | ||
273 | if (C && VTy) | ||
274 | { // Vector constant | ||
275 | llvm::Type* eTy = VTy->getElementType(); | ||
276 | @@ -1996,7 +1996,7 @@ uint32_t CShader::GetNumElts(llvm::Type* type, bool isUniform) | ||
277 | { | ||
278 | IGC_ASSERT(type->getContainedType(0)->isIntegerTy() || type->getContainedType(0)->isFloatingPointTy()); | ||
279 | |||
280 | - auto VT = cast<VectorType>(type); | ||
281 | + auto VT = cast<IGCLLVM::FixedVectorType>(type); | ||
282 | numElts *= (uint16_t)VT->getNumElements(); | ||
283 | } | ||
284 | else if (type->isStructTy()) | ||
285 | @@ -2709,7 +2709,7 @@ CVariable* CShader::GetSymbol(llvm::Value* value, bool fromConstantPool) | ||
286 | if (isVecType) | ||
287 | { | ||
288 | // Map the entire vector value to the CVar | ||
289 | - unsigned numElements = (unsigned)cast<VectorType>(value->getType())->getNumElements(); | ||
290 | + unsigned numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(value->getType())->getNumElements(); | ||
291 | var = GetNewVariable(numElements, ISA_TYPE_UQ, | ||
292 | (GetContext()->platform.getGRFSize() == 64) ? EALIGN_32WORD : EALIGN_HWORD, | ||
293 | WIBaseClass::UNIFORM_GLOBAL, 1, valName); | ||
294 | @@ -3619,7 +3619,7 @@ unsigned int CShader::GetPrimitiveTypeSizeInRegisterInBits(const Type* Ty) const | ||
295 | { | ||
296 | sizeInBits = | ||
297 | GetContext()->getRegisterPointerSizeInBits(Ty->getPointerAddressSpace()); | ||
298 | - if (auto* VTy = dyn_cast<VectorType>(Ty)) | ||
299 | + if (auto* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty)) | ||
300 | { | ||
301 | sizeInBits *= (unsigned)VTy->getNumElements(); | ||
302 | } | ||
303 | diff --git a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp | ||
304 | index 43fcfc7c0..8d58414b6 100644 | ||
305 | --- a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp | ||
306 | +++ b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp | ||
307 | @@ -182,7 +182,7 @@ static void checkInsertExtractMatch(InsertElementInst* insertInst, Value* base, | ||
308 | |||
309 | static bool canReplaceInsert(InsertElementInst* insertElt) | ||
310 | { | ||
311 | - VectorType* VTy = cast<VectorType>(insertElt->getOperand(0)->getType()); | ||
312 | + IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(insertElt->getOperand(0)->getType()); | ||
313 | ConstantInt* index = dyn_cast<ConstantInt>(insertElt->getOperand(2)); | ||
314 | if (!index || index->getZExtValue() != VTy->getNumElements() - 1) | ||
315 | { | ||
316 | @@ -270,7 +270,7 @@ void ConstantCoalescing::VectorizePrep(llvm::BasicBlock* bb) | ||
317 | { | ||
318 | if (load->getType()->isVectorTy() && wiAns->isUniform(load)) | ||
319 | { | ||
320 | - srcNElts = (uint32_t)cast<VectorType>(load->getType())->getNumElements(); | ||
321 | + srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(load->getType())->getNumElements(); | ||
322 | DenseMap<uint64_t, Instruction*> extractElementMap; | ||
323 | |||
324 | for (auto iter = load->user_begin(); iter != load->user_end(); iter++) | ||
325 | @@ -354,7 +354,7 @@ bool ConstantCoalescing::isProfitableLoad( | ||
326 | (isa<LoadInst>(I) && wiAns->isUniform(I)) ? | ||
327 | 16 : 4; | ||
328 | |||
329 | - if (cast<VectorType>(LoadTy)->getNumElements() > MaxVectorInput) | ||
330 | + if (cast<IGCLLVM::FixedVectorType>(LoadTy)->getNumElements() > MaxVectorInput) | ||
331 | return false; | ||
332 | |||
333 | MaxEltPlus = CheckVectorElementUses(I); | ||
334 | @@ -1933,7 +1933,7 @@ void ConstantCoalescing::AdjustChunk(BufChunk* cov_chunk, uint start_adj, uint s | ||
335 | WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO); | ||
336 | irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode()); | ||
337 | Value* vec = UndefValue::get(originalType); | ||
338 | - for (unsigned i = 0; i < cast<VectorType>(originalType)->getNumElements(); i++) | ||
339 | + for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(originalType)->getNumElements(); i++) | ||
340 | { | ||
341 | Value* channel = irBuilder->CreateExtractElement( | ||
342 | cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj)); | ||
343 | @@ -1997,7 +1997,7 @@ void ConstantCoalescing::MoveExtracts(BufChunk* cov_chunk, Instruction* load, ui | ||
344 | irBuilder->SetInsertPoint(load->getNextNode()); | ||
345 | Type* vecType = load->getType(); | ||
346 | Value* vec = UndefValue::get(vecType); | ||
347 | - for (unsigned i = 0; i < cast<VectorType>(vecType)->getNumElements(); i++) | ||
348 | + for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(vecType)->getNumElements(); i++) | ||
349 | { | ||
350 | Value* channel = irBuilder->CreateExtractElement( | ||
351 | cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj)); | ||
352 | @@ -2061,7 +2061,7 @@ void ConstantCoalescing::EnlargeChunk(BufChunk* cov_chunk, uint size_adj) | ||
353 | WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO); | ||
354 | irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode()); | ||
355 | Value* vec = UndefValue::get(originalType); | ||
356 | - for (unsigned i = 0; i < cast<VectorType>(originalType)->getNumElements(); i++) | ||
357 | + for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(originalType)->getNumElements(); i++) | ||
358 | { | ||
359 | Value* channel = irBuilder->CreateExtractElement( | ||
360 | cov_chunk->chunkIO, irBuilder->getInt32(i)); | ||
361 | @@ -2498,7 +2498,7 @@ void ConstantCoalescing::ReplaceLoadWithSamplerLoad( | ||
362 | if (dstTy->isVectorTy()) | ||
363 | { | ||
364 | result = UndefValue::get(dstTy); | ||
365 | - for (uint i = 0; i < cast<VectorType>(dstTy)->getNumElements(); i++) | ||
366 | + for (uint i = 0; i < cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements(); i++) | ||
367 | { | ||
368 | Value* tmpData = ExtractFromSamplerData(cast<VectorType>(dstTy)->getElementType(), i); | ||
369 | result = irBuilder->CreateInsertElement(result, tmpData, irBuilder->getInt32(i)); | ||
370 | diff --git a/IGC/Compiler/CISACodeGen/DeSSA.cpp b/IGC/Compiler/CISACodeGen/DeSSA.cpp | ||
371 | index bc06a00d2..8ac30bac2 100644 | ||
372 | --- a/IGC/Compiler/CISACodeGen/DeSSA.cpp | ||
373 | +++ b/IGC/Compiler/CISACodeGen/DeSSA.cpp | ||
374 | @@ -67,6 +67,7 @@ See LICENSE.TXT for details. | ||
375 | #include "common/LLVMWarningsPush.hpp" | ||
376 | #include "llvmWrapper/IR/Instructions.h" | ||
377 | #include <llvm/IR/InstIterator.h> | ||
378 | +#include <llvmWrapper/IR/DerivedTypes.h> | ||
379 | #include <llvm/IR/InlineAsm.h> | ||
380 | #include "common/LLVMWarningsPop.hpp" | ||
381 | #include <algorithm> | ||
382 | @@ -1302,7 +1303,7 @@ int DeSSA::checkInsertElementAlias( | ||
383 | // | ||
384 | // If found, return the actual vector size; | ||
385 | // otherwise, return 0. | ||
386 | - VectorType* VTy = cast<VectorType>(IEI->getType()); | ||
387 | + IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(IEI->getType()); | ||
388 | IGC_ASSERT(nullptr != VTy); | ||
389 | int nelts = (int)VTy->getNumElements(); | ||
390 | AllIEIs.resize(nelts, nullptr); | ||
391 | @@ -1491,4 +1492,4 @@ bool DeSSA::alignInterfere(e_alignment a1, e_alignment a2) | ||
392 | return true; | ||
393 | } | ||
394 | return false; | ||
395 | -} | ||
396 | \ No newline at end of file | ||
397 | +} | ||
398 | diff --git a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp | ||
399 | index dda1529eb..5541dee74 100644 | ||
400 | --- a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp | ||
401 | +++ b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp | ||
402 | @@ -1265,7 +1265,7 @@ bool EmitPass::canRelocatePhiMov( | ||
403 | if (dst != src) | ||
404 | { | ||
405 | int numElt = 1; | ||
406 | - if (VectorType * vTy = dyn_cast<VectorType>(PN->getType())) | ||
407 | + if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(PN->getType())) | ||
408 | { | ||
409 | numElt = int_cast<int>(vTy->getNumElements()); | ||
410 | } | ||
411 | @@ -1402,7 +1402,7 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB) | ||
412 | phiSrcDstList.push_back(phiInfo); | ||
413 | |||
414 | int numElt = 0; | ||
415 | - if (VectorType * vTy = dyn_cast<VectorType>(PN->getType())) | ||
416 | + if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(PN->getType())) | ||
417 | { | ||
418 | numElt = int_cast<int>(vTy->getNumElements()); | ||
419 | } | ||
420 | @@ -5606,7 +5606,7 @@ void EmitPass::emitLegacySimdBlockWrite(llvm::Instruction* inst, llvm::Value* pt | ||
421 | bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext()); | ||
422 | |||
423 | Type* Ty = dataPtr->getType(); | ||
424 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
425 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
426 | uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; | ||
427 | |||
428 | uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8; | ||
429 | @@ -5852,7 +5852,7 @@ void EmitPass::emitLegacySimdBlockRead(llvm::Instruction* inst, llvm::Value* ptr | ||
430 | bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext()); | ||
431 | |||
432 | Type* Ty = inst->getType(); | ||
433 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
434 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
435 | uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; | ||
436 | |||
437 | uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8; | ||
438 | @@ -6144,7 +6144,7 @@ void EmitPass::emitMediaBlockIO(const llvm::GenIntrinsicInst* inst, bool isRead) | ||
439 | }; | ||
440 | |||
441 | uint nElts = isa<VectorType>(pDataType) ? | ||
442 | - (uint)cast<VectorType>(pDataType)->getNumElements() : | ||
443 | + (uint)cast<IGCLLVM::FixedVectorType>(pDataType)->getNumElements() : | ||
444 | 1; | ||
445 | |||
446 | // Now, do the copies. | ||
447 | @@ -6234,7 +6234,7 @@ void EmitPass::emitSimdMediaBlockRead(llvm::Instruction* inst) | ||
448 | uint32_t nbElements = 1; | ||
449 | if (inst->getType()->isVectorTy()) | ||
450 | { | ||
451 | - nbElements = (uint32_t)cast<VectorType>(inst->getType())->getNumElements(); | ||
452 | + nbElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements(); | ||
453 | } | ||
454 | IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size"); | ||
455 | |||
456 | @@ -6478,7 +6478,7 @@ void EmitPass::emitSimdMediaBlockWrite(llvm::Instruction* inst) | ||
457 | uint32_t nbElements = 1; | ||
458 | if (dataPtr->getType()->isVectorTy()) | ||
459 | { | ||
460 | - nbElements = (uint32_t)cast<VectorType>(dataPtr->getType())->getNumElements(); | ||
461 | + nbElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(dataPtr->getType())->getNumElements(); | ||
462 | } | ||
463 | IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size"); | ||
464 | |||
465 | @@ -9140,7 +9140,7 @@ void EmitPass::EmitInlineAsm(llvm::CallInst* inst) | ||
466 | { | ||
467 | if (inst->getType()->isVectorTy()) | ||
468 | { | ||
469 | - emitVectorCopy(dest, cv, int_cast<unsigned>(dyn_cast<VectorType>(inst->getType())->getNumElements())); | ||
470 | + emitVectorCopy(dest, cv, int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements())); | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | @@ -9415,9 +9415,9 @@ void EmitPass::emitBitCast(llvm::BitCastInst* btCst) | ||
475 | { | ||
476 | Type* srcType = btCst->getOperand(0)->getType(); | ||
477 | Type* dstType = btCst->getType(); | ||
478 | - unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<VectorType>(srcType)->getNumElements() : 1; | ||
479 | - unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<VectorType>(dstType)->getNumElements() : 1; | ||
480 | - | ||
481 | + unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(srcType)->getNumElements() : 1; | ||
482 | + unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(dstType)->getNumElements() : 1; | ||
483 | + | ||
484 | if (srcType->isPointerTy()) | ||
485 | { | ||
486 | IGC_ASSERT_MESSAGE(dstType->isPointerTy(), "Expected both src and dst have pointer type."); | ||
487 | @@ -9863,7 +9863,7 @@ void EmitPass::emitLoad3DInner(LdRawIntrinsic* inst, ResourceDescriptor& resourc | ||
488 | { | ||
489 | IGC_ASSERT_MESSAGE(predDefSurface != ESURFACE_STATELESS, "scratch cannot be uniform"); | ||
490 | Type* loadType = inst->getType(); | ||
491 | - uint numElement = loadType->isVectorTy() ? (uint)cast<VectorType>(loadType)->getNumElements() : 1; | ||
492 | + uint numElement = loadType->isVectorTy() ? (uint)cast<IGCLLVM::FixedVectorType>(loadType)->getNumElements() : 1; | ||
493 | if (predDefSurface == ESURFACE_SLM) | ||
494 | { | ||
495 | IGC_ASSERT(numElement <= 4); | ||
496 | @@ -11278,7 +11278,7 @@ void EmitPass::emitInsert(llvm::Instruction* inst) | ||
497 | pVecVar = GetSymbol(pVec); | ||
498 | if (pVecVar != pInstVar) | ||
499 | { | ||
500 | - emitVectorCopy(pInstVar, pVecVar, int_cast<unsigned>(dyn_cast<VectorType>(pVecType)->getNumElements())); | ||
501 | + emitVectorCopy(pInstVar, pVecVar, int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(pVecType)->getNumElements())); | ||
502 | } | ||
503 | } | ||
504 | } | ||
505 | @@ -15233,7 +15233,7 @@ bool EmitPass::isUniformStoreOCL(Value* ptr, Value* storeVal) | ||
506 | } | ||
507 | |||
508 | Type* Ty = storeVal->getType(); | ||
509 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
510 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
511 | uint32_t elts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; | ||
512 | Type* eltTy = VTy ? VTy->getElementType() : Ty; | ||
513 | |||
514 | @@ -15269,7 +15269,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI) | ||
515 | if (srcTy->isVectorTy()) | ||
516 | { | ||
517 | srcEltTy = cast<VectorType>(srcTy)->getElementType(); | ||
518 | - srcNElts = (uint32_t)cast<VectorType>(srcTy)->getNumElements(); | ||
519 | + srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(srcTy)->getNumElements(); | ||
520 | } | ||
521 | else | ||
522 | { | ||
523 | @@ -15279,7 +15279,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI) | ||
524 | if (dstTy->isVectorTy()) | ||
525 | { | ||
526 | dstEltTy = cast<VectorType>(dstTy)->getElementType(); | ||
527 | - dstNElts = (uint32_t)cast<VectorType>(dstTy)->getNumElements(); | ||
528 | + dstNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements(); | ||
529 | } | ||
530 | else | ||
531 | { | ||
532 | @@ -15867,7 +15867,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff | ||
533 | } | ||
534 | |||
535 | Type* Ty = inst->getType(); | ||
536 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
537 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
538 | Type* eltTy = VTy ? VTy->getElementType() : Ty; | ||
539 | uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy); | ||
540 | IGC_ASSERT_MESSAGE((eltBytes == 1) || (eltBytes == 2) || (eltBytes == 4) || (eltBytes == 8), | ||
541 | @@ -16381,7 +16381,7 @@ void EmitPass::emitVectorStore(StoreInst* inst, Value* offset, ConstantInt* immO | ||
542 | |||
543 | Value* storedVal = inst->getValueOperand(); | ||
544 | Type* Ty = storedVal->getType(); | ||
545 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
546 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
547 | Type* eltTy = VTy ? VTy->getElementType() : Ty; | ||
548 | uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy); | ||
549 | |||
550 | @@ -17189,7 +17189,7 @@ void EmitPass::emitCopyAll(CVariable* Dst, CVariable* Src, llvm::Type* Ty) | ||
551 | } | ||
552 | else if (Ty->isVectorTy()) | ||
553 | { | ||
554 | - unsigned NElts = (unsigned)cast<VectorType>(Ty)->getNumElements(); | ||
555 | + unsigned NElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); | ||
556 | emitVectorCopy(Dst, Src, NElts); | ||
557 | } | ||
558 | else if (Ty->isStructTy()) | ||
559 | @@ -18347,9 +18347,9 @@ void EmitPass::emitfcvt(llvm::GenIntrinsicInst* GII) | ||
560 | CVariable* dst = m_destination; | ||
561 | |||
562 | Type* dTy = GII->getType(); | ||
563 | - VectorType* dVTy = dyn_cast<VectorType>(dTy); | ||
564 | + IGCLLVM::FixedVectorType* dVTy = dyn_cast<IGCLLVM::FixedVectorType>(dTy); | ||
565 | Type* sTy = sVal->getType(); | ||
566 | - VectorType* sVTy = dyn_cast<VectorType>(sTy); | ||
567 | + IGCLLVM::FixedVectorType* sVTy = dyn_cast<IGCLLVM::FixedVectorType>(sTy); | ||
568 | int nelts = dVTy ? (int)dVTy->getNumElements() : 1; | ||
569 | int src_nelts = sVTy ? (int)sVTy->getNumElements() : 1; | ||
570 | if (nelts != src_nelts) | ||
571 | diff --git a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp | ||
572 | index 1c30ae361..db77b514d 100644 | ||
573 | --- a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp | ||
574 | +++ b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp | ||
575 | @@ -1945,7 +1945,7 @@ bool InstExpander::visitExtractElement(ExtractElementInst& EEI) { | ||
576 | // later. | ||
577 | |||
578 | Value* V = EEI.getVectorOperand(); | ||
579 | - unsigned NumElts = (unsigned)cast<VectorType>(V->getType())->getNumElements(); | ||
580 | + unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(V->getType())->getNumElements(); | ||
581 | V = IRB->CreateBitCast(V, Emu->getV2Int32Ty(NumElts)); | ||
582 | // Re-calculate indices to Lo and Hi parts. | ||
583 | Value* Idx = EEI.getIndexOperand(); | ||
584 | @@ -1982,7 +1982,7 @@ bool InstExpander::visitInsertElement(InsertElementInst& IEI) { | ||
585 | |||
586 | // Create the emulated vector. | ||
587 | Value* NewVal = IEI.getOperand(0); | ||
588 | - unsigned NumElts = (unsigned)cast<VectorType>(NewVal->getType())->getNumElements(); | ||
589 | + unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(NewVal->getType())->getNumElements(); | ||
590 | NewVal = IRB->CreateBitCast(NewVal, Emu->getV2Int32Ty(NumElts)); | ||
591 | // Re-calculate indices to Lo and Hi parts. | ||
592 | Value* Idx = IEI.getOperand(2); | ||
593 | diff --git a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp | ||
594 | index 71e3bdf06..311964b9c 100644 | ||
595 | --- a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp | ||
596 | +++ b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp | ||
597 | @@ -437,7 +437,7 @@ Value* GEPLowering::getSExtOrTrunc(Value* Val, Type* NewTy) const { | ||
598 | |||
599 | IGC_ASSERT_MESSAGE(OldTy->isIntOrIntVectorTy(), "Index should be Integer or vector of Integer!"); | ||
600 | |||
601 | - if (auto OldVecTy = dyn_cast<VectorType>(OldTy)) { | ||
602 | + if (auto OldVecTy = dyn_cast<IGCLLVM::FixedVectorType>(OldTy)) { | ||
603 | OldWidth = (unsigned)OldVecTy->getNumElements() * OldVecTy->getElementType()->getIntegerBitWidth(); | ||
604 | NewWidth = (unsigned)OldVecTy->getNumElements() * NewTy->getIntegerBitWidth(); | ||
605 | } | ||
606 | @@ -789,7 +789,7 @@ bool GEPLowering::lowerGetElementPtrInst(GetElementPtrInst* GEP) const | ||
607 | } | ||
608 | else | ||
609 | { | ||
610 | - if (auto NewIdxVT = dyn_cast<VectorType>(NewIdx->getType())) { | ||
611 | + if (auto NewIdxVT = dyn_cast<IGCLLVM::FixedVectorType>(NewIdx->getType())) { | ||
612 | Value* result = llvm::UndefValue::get(FixedVectorType::get(PtrMathTy, (unsigned)NewIdxVT->getNumElements())); | ||
613 | for (uint32_t j = 0; j < (uint32_t)NewIdxVT->getNumElements(); j++) { | ||
614 | result = Builder->CreateInsertElement(result, PointerValue, Builder->getInt32(j)); | ||
615 | diff --git a/IGC/Compiler/CISACodeGen/GenSimplification.cpp b/IGC/Compiler/CISACodeGen/GenSimplification.cpp | ||
616 | index 23ab58538..f97482b6c 100644 | ||
617 | --- a/IGC/Compiler/CISACodeGen/GenSimplification.cpp | ||
618 | +++ b/IGC/Compiler/CISACodeGen/GenSimplification.cpp | ||
619 | @@ -19,6 +19,7 @@ SPDX-License-Identifier: MIT | ||
620 | #include <llvm/IR/InstVisitor.h> | ||
621 | #include <llvm/IR/Instruction.h> | ||
622 | #include <llvm/Support/raw_ostream.h> | ||
623 | +#include <llvmWrapper/IR/DerivedTypes.h> | ||
624 | #include "common/LLVMWarningsPop.hpp" | ||
625 | #include "Probe/Assertion.h" | ||
626 | |||
627 | @@ -148,7 +149,7 @@ bool GenSimplification::simplifyVectorPHINodeCase2(PHINode& PN) const { | ||
628 | |||
629 | Type* Ty = PN.getType(); | ||
630 | Type* EltTy = Ty->getScalarType(); | ||
631 | - unsigned NumElts = (unsigned)cast<VectorType>(Ty)->getNumElements(); | ||
632 | + unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); | ||
633 | |||
634 | SmallVector<Value*, 8> Lanes; | ||
635 | SmallVector<SmallVector<Value*, 8>, 4> Values; | ||
636 | @@ -222,7 +223,7 @@ void GenSimplification::visitPHINode(PHINode& PN) { | ||
637 | void GenSimplification::visitExtractElement(ExtractElementInst& EEI) { | ||
638 | // Skip non-2-element vector. | ||
639 | Value* Vec = EEI.getVectorOperand(); | ||
640 | - VectorType* VTy = cast<VectorType>(Vec->getType()); | ||
641 | + IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(Vec->getType()); | ||
642 | if (VTy->getNumElements() != 2) | ||
643 | return; | ||
644 | |||
645 | diff --git a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp | ||
646 | index 20638a0fe..6982ed252 100644 | ||
647 | --- a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp | ||
648 | +++ b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp | ||
649 | @@ -17,6 +17,7 @@ SPDX-License-Identifier: MIT | ||
650 | #include <llvm/IR/PassManager.h> | ||
651 | #include <llvm/IR/IRBuilder.h> | ||
652 | #include <llvm/IR/Verifier.h> | ||
653 | +#include <llvmWrapper/IR/DerivedTypes.h> | ||
654 | #include "common/LLVMWarningsPop.hpp" | ||
655 | #include "Compiler/InitializePasses.h" | ||
656 | #include "Probe/Assertion.h" | ||
657 | @@ -444,7 +445,7 @@ void GeometryShaderLowering::AddURBRead( | ||
658 | { | ||
659 | Value* vec = UndefValue::get(inst->getType()); | ||
660 | IRBuilder<> builder(inst); | ||
661 | - for (unsigned int i = 0; i < cast<VectorType>(inst->getType())->getNumElements(); i++) | ||
662 | + for (unsigned int i = 0; i < cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements(); i++) | ||
663 | { | ||
664 | Value* vecElement = builder.CreateExtractElement(urbRead, builder.getInt32(i)); | ||
665 | vec = builder.CreateInsertElement(vec, vecElement, builder.getInt32(i)); | ||
666 | diff --git a/IGC/Compiler/CISACodeGen/LdShrink.cpp b/IGC/Compiler/CISACodeGen/LdShrink.cpp | ||
667 | index 91226eeb2..f7099d6fb 100644 | ||
668 | --- a/IGC/Compiler/CISACodeGen/LdShrink.cpp | ||
669 | +++ b/IGC/Compiler/CISACodeGen/LdShrink.cpp | ||
670 | @@ -14,6 +14,7 @@ SPDX-License-Identifier: MIT | ||
671 | #include <llvm/Support/Debug.h> | ||
672 | #include <llvm/Support/MathExtras.h> | ||
673 | #include <llvm/Support/raw_ostream.h> | ||
674 | +#include <llvmWrapper/IR/DerivedTypes.h> | ||
675 | #include "common/LLVMWarningsPop.hpp" | ||
676 | #include "Compiler/CISACodeGen/ShaderCodeGen.hpp" | ||
677 | #include "Compiler/IGCPassSupport.h" | ||
678 | @@ -63,7 +64,7 @@ IGC_INITIALIZE_PASS_BEGIN(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_AN | ||
679 | IGC_INITIALIZE_PASS_END(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_ANALYSIS) | ||
680 | |||
681 | unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const { | ||
682 | - VectorType* VTy = dyn_cast<VectorType>(LI->getType()); | ||
683 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(LI->getType()); | ||
684 | // Skip non-vector loads. | ||
685 | if (!VTy) | ||
686 | return 0; | ||
687 | @@ -75,9 +76,12 @@ unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const { | ||
688 | Type* Ty = VTy->getScalarType(); | ||
689 | // Skip non-BYTE addressable data types. So far, check integer types | ||
690 | // only. | ||
691 | - if (IntegerType * ITy = dyn_cast<IntegerType>(Ty)) | ||
692 | - if (!ITy->isPowerOf2ByteWidth()) | ||
693 | + if (IntegerType * ITy = dyn_cast<IntegerType>(Ty)) { | ||
694 | + // Unroll isPowerOf2ByteWidth, it was removed in LLVM 12. | ||
695 | + unsigned BitWidth = ITy->getBitWidth(); | ||
696 | + if (!((BitWidth > 7) && isPowerOf2_32(BitWidth))) | ||
697 | return 0; | ||
698 | + } | ||
699 | |||
700 | unsigned Mask = 0; // Maxmimally 32 elements. | ||
701 | |||
702 | diff --git a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp | ||
703 | index ffd4bdc41..15d7f6d6d 100644 | ||
704 | --- a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp | ||
705 | +++ b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp | ||
706 | @@ -603,7 +603,7 @@ void TransposeHelper::handleGEPInst( | ||
707 | } | ||
708 | else | ||
709 | { | ||
710 | - arr_sz = (unsigned)cast<VectorType>(T)->getNumElements(); | ||
711 | + arr_sz = (unsigned)cast<IGCLLVM::FixedVectorType>(T)->getNumElements(); | ||
712 | } | ||
713 | T = cast<VectorType>(T)->getElementType(); | ||
714 | } | ||
715 | @@ -625,7 +625,7 @@ void TransposeHelper::handleGEPInst( | ||
716 | } | ||
717 | else if (T->isVectorTy()) | ||
718 | { | ||
719 | - arr_sz = (unsigned)cast<VectorType>(T)->getNumElements(); | ||
720 | + arr_sz = (unsigned)cast<IGCLLVM::FixedVectorType>(T)->getNumElements(); | ||
721 | T = cast<VectorType>(T)->getElementType(); | ||
722 | } | ||
723 | else | ||
724 | @@ -685,7 +685,7 @@ void TransposeHelperPromote::handleLoadInst( | ||
725 | IRBuilder<> IRB(pLoad); | ||
726 | IGC_ASSERT(nullptr != pLoad->getType()); | ||
727 | unsigned N = pLoad->getType()->isVectorTy() | ||
728 | - ? (unsigned)cast<VectorType>(pLoad->getType())->getNumElements() | ||
729 | + ? (unsigned)cast<IGCLLVM::FixedVectorType>(pLoad->getType())->getNumElements() | ||
730 | : 1; | ||
731 | Value* Val = loadEltsFromVecAlloca(N, pVecAlloca, pScalarizedIdx, IRB, pLoad->getType()->getScalarType()); | ||
732 | pLoad->replaceAllUsesWith(Val); | ||
733 | @@ -717,7 +717,7 @@ void TransposeHelperPromote::handleStoreInst( | ||
734 | // %v1 = extractelement <2 x float> %v, i32 1 | ||
735 | // %w1 = insertelement <32 x float> %w0, float %v1, i32 %idx+1 | ||
736 | // store <32 x float> %w1, <32 x float>* %ptr1 | ||
737 | - for (unsigned i = 0, e = (unsigned)cast<VectorType>(pStoreVal->getType())->getNumElements(); i < e; ++i) | ||
738 | + for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(pStoreVal->getType())->getNumElements(); i < e; ++i) | ||
739 | { | ||
740 | Value* VectorIdx = ConstantInt::get(pScalarizedIdx->getType(), i); | ||
741 | auto Val = IRB.CreateExtractElement(pStoreVal, VectorIdx); | ||
742 | diff --git a/IGC/Compiler/CISACodeGen/MemOpt.cpp b/IGC/Compiler/CISACodeGen/MemOpt.cpp | ||
743 | index 32f24ba1c..c85eb1238 100644 | ||
744 | --- a/IGC/Compiler/CISACodeGen/MemOpt.cpp | ||
745 | +++ b/IGC/Compiler/CISACodeGen/MemOpt.cpp | ||
746 | @@ -108,7 +108,7 @@ namespace { | ||
747 | MemRefListTy& MemRefs, TrivialMemRefListTy& ToOpt); | ||
748 | |||
749 | unsigned getNumElements(Type* Ty) const { | ||
750 | - return Ty->isVectorTy() ? (unsigned)cast<VectorType>(Ty)->getNumElements() : 1; | ||
751 | + return Ty->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements() : 1; | ||
752 | } | ||
753 | |||
754 | MemoryLocation getLocation(Instruction* I) const { | ||
755 | @@ -922,7 +922,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad, | ||
756 | Pos = unsigned((std::get<1>(I) - FirstOffset) / LdScalarSize); | ||
757 | |||
758 | if (Ty->isVectorTy()) { | ||
759 | - if (Pos + cast<VectorType>(Ty)->getNumElements() > NumElts) { | ||
760 | + if (Pos + cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements() > NumElts) { | ||
761 | // This implies we're trying to extract an element from our new load | ||
762 | // with an index > the size of the new load. If this happens, | ||
763 | // we'll generate correct code if it does since we don't remove the | ||
764 | @@ -930,7 +930,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad, | ||
765 | continue; | ||
766 | } | ||
767 | Value* Val = UndefValue::get(Ty); | ||
768 | - for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i) { | ||
769 | + for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i) { | ||
770 | Value* Ex = Builder.CreateExtractElement(NewLoad, Builder.getInt32(Pos + i)); | ||
771 | Ex = createBitOrPointerCast(Ex, ScalarTy, Builder); | ||
772 | Val = Builder.CreateInsertElement(Val, Ex, Builder.getInt32(i)); | ||
773 | @@ -1312,7 +1312,7 @@ bool MemOpt::mergeStore(StoreInst* LeadingStore, | ||
774 | IGC_ASSERT(hasSameSize(ScalarTy, LeadingStoreScalarType)); | ||
775 | |||
776 | if (Ty->isVectorTy()) { | ||
777 | - for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i) { | ||
778 | + for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i) { | ||
779 | Value* Ex = Builder.CreateExtractElement(Val, Builder.getInt32(i)); | ||
780 | Ex = createBitOrPointerCast(Ex, LeadingStoreScalarType, Builder); | ||
781 | NewStoreVal = Builder.CreateInsertElement(NewStoreVal, Ex, | ||
782 | diff --git a/IGC/Compiler/CISACodeGen/MemOpt2.cpp b/IGC/Compiler/CISACodeGen/MemOpt2.cpp | ||
783 | index 989727107..96e1ec303 100644 | ||
784 | --- a/IGC/Compiler/CISACodeGen/MemOpt2.cpp | ||
785 | +++ b/IGC/Compiler/CISACodeGen/MemOpt2.cpp | ||
786 | @@ -16,6 +16,7 @@ SPDX-License-Identifier: MIT | ||
787 | #include <llvm/Support/Debug.h> | ||
788 | #include <llvm/Support/raw_ostream.h> | ||
789 | #include <llvm/Transforms/Utils/Local.h> | ||
790 | +#include <llvmWrapper/IR/DerivedTypes.h> | ||
791 | #include "common/LLVMWarningsPop.hpp" | ||
792 | #include "GenISAIntrinsics/GenIntrinsics.h" | ||
793 | |||
794 | @@ -108,7 +109,7 @@ namespace { | ||
795 | if (!Ty->isSingleValueType()) | ||
796 | return UINT_MAX; | ||
797 | // Simply return 1 so far for scalar types. | ||
798 | - VectorType* VecTy = dyn_cast<VectorType>(Ty); | ||
799 | + IGCLLVM::FixedVectorType* VecTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
800 | if (!VecTy) | ||
801 | return 1; | ||
802 | // Check how that vector is used. | ||
803 | @@ -137,7 +138,7 @@ namespace { | ||
804 | return UINT_MAX; | ||
805 | unsigned EltByte = (Ty->getScalarSizeInBits() + 7) / 8; | ||
806 | // Simply return 1 so far for scalar types. | ||
807 | - VectorType* VecTy = dyn_cast<VectorType>(Ty); | ||
808 | + IGCLLVM::FixedVectorType* VecTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
809 | if (!VecTy) | ||
810 | return EltByte; | ||
811 | // Check how that vector is used. | ||
812 | diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp | ||
813 | index 01272b03b..8dc187ebf 100644 | ||
814 | --- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp | ||
815 | +++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp | ||
816 | @@ -409,7 +409,7 @@ namespace IGC | ||
817 | unsigned int numElements = 1; | ||
818 | if (baseType->isVectorTy()) | ||
819 | { | ||
820 | - numElements = (unsigned)cast<VectorType>(baseType)->getNumElements(); | ||
821 | + numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(baseType)->getNumElements(); | ||
822 | baseType = cast<VectorType>(baseType)->getElementType(); | ||
823 | } | ||
824 | |||
825 | diff --git a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp | ||
826 | index cd048136a..51632e3d9 100644 | ||
827 | --- a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp | ||
828 | +++ b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp | ||
829 | @@ -2438,7 +2438,7 @@ namespace IGC | ||
830 | // Store3d supports only types equal or less than 128 bits. | ||
831 | if (auto* storeInst = dyn_cast<StoreInst>(&I)) | ||
832 | { | ||
833 | - llvm::VectorType* vectorToStore = dyn_cast<llvm::VectorType>(storeInst->getValueOperand()->getType()); | ||
834 | + IGCLLVM::FixedVectorType* vectorToStore = dyn_cast<IGCLLVM::FixedVectorType>(storeInst->getValueOperand()->getType()); | ||
835 | |||
836 | // If stored value is a vector of pointers, the size must be calculated manually, | ||
837 | // because getPrimitiveSizeInBits returns 0 for pointers. | ||
838 | @@ -3072,8 +3072,8 @@ namespace IGC | ||
839 | llvm::Type* srcTy = bTInst->getOperand(0)->getType(); | ||
840 | llvm::Type* dstTy = bTInst->getType(); | ||
841 | |||
842 | - srcNElts = (srcTy->isVectorTy()) ? (uint32_t)cast<VectorType>(srcTy)->getNumElements() : 1; | ||
843 | - dstNElts = (dstTy->isVectorTy()) ? (uint32_t)cast<VectorType>(dstTy)->getNumElements() : 1; | ||
844 | + srcNElts = (srcTy->isVectorTy()) ? (uint32_t)cast<IGCLLVM::FixedVectorType>(srcTy)->getNumElements() : 1; | ||
845 | + dstNElts = (dstTy->isVectorTy()) ? (uint32_t)cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements() : 1; | ||
846 | |||
847 | if (srcNElts < dstNElts && srcTy->getScalarSizeInBits() < 64) | ||
848 | { | ||
849 | diff --git a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp | ||
850 | index 4f905cc9a..0ee5ffbc0 100644 | ||
851 | --- a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp | ||
852 | +++ b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp | ||
853 | @@ -987,7 +987,7 @@ namespace IGC | ||
854 | |||
855 | if (pTypeToPush->isVectorTy()) | ||
856 | { | ||
857 | - num_elms = (unsigned)cast<VectorType>(pTypeToPush)->getNumElements(); | ||
858 | + num_elms = (unsigned)cast<IGCLLVM::FixedVectorType>(pTypeToPush)->getNumElements(); | ||
859 | pTypeToPush = cast<VectorType>(pTypeToPush)->getElementType(); | ||
860 | llvm::Type* pVecTy = IGCLLVM::FixedVectorType::get(pTypeToPush, num_elms); | ||
861 | pReplacedInst = llvm::UndefValue::get(pVecTy); | ||
862 | @@ -1178,7 +1178,7 @@ namespace IGC | ||
863 | } | ||
864 | |||
865 | unsigned num_elms = | ||
866 | - inst->getType()->isVectorTy() ? (unsigned)cast<VectorType>(inst->getType())->getNumElements() : 1; | ||
867 | + inst->getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements() : 1; | ||
868 | llvm::Type* pTypeToPush = inst->getType(); | ||
869 | llvm::Value* replaceVector = nullptr; | ||
870 | unsigned int numberChannelReplaced = 0; | ||
871 | diff --git a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp | ||
872 | index dee494d73..ef33489c3 100644 | ||
873 | --- a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp | ||
874 | +++ b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp | ||
875 | @@ -25,6 +25,7 @@ SPDX-License-Identifier: MIT | ||
876 | #include <llvm/IR/IRBuilder.h> | ||
877 | #include <llvm/IR/InstIterator.h> | ||
878 | #include <llvm/Support/MathExtras.h> | ||
879 | +#include <llvmWrapper/IR/DerivedTypes.h> | ||
880 | #include "common/LLVMWarningsPop.hpp" | ||
881 | #include "Probe/Assertion.h" | ||
882 | |||
883 | @@ -130,7 +131,7 @@ RegUse RegisterEstimator::estimateNumOfRegs(Value* V) const | ||
884 | Type* Ty = V->getType(); | ||
885 | if (!Ty->isVoidTy()) | ||
886 | { | ||
887 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
888 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
889 | Type* eltTy = VTy ? VTy->getElementType() : Ty; | ||
890 | uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; | ||
891 | uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy); | ||
892 | diff --git a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp | ||
893 | index 6148817e1..80898be35 100644 | ||
894 | --- a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp | ||
895 | +++ b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp | ||
896 | @@ -24,6 +24,7 @@ See LICENSE.TXT for details. | ||
897 | #include "llvm/Pass.h" | ||
898 | #include <llvm/IR/InstVisitor.h> | ||
899 | #include "llvm/Analysis/LoopInfo.h" | ||
900 | +#include <llvmWrapper/IR/DerivedTypes.h> | ||
901 | #include "common/LLVMWarningsPop.hpp" | ||
902 | #include "Compiler/IGCPassSupport.h" | ||
903 | #include "Compiler/CISACodeGen/WIAnalysis.hpp" | ||
904 | @@ -222,7 +223,7 @@ namespace IGC | ||
905 | auto Ty = V->getType(); | ||
906 | if (Ty->isVoidTy()) | ||
907 | return 0; | ||
908 | - auto VTy = llvm::dyn_cast<llvm::VectorType>(Ty); | ||
909 | + auto VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
910 | auto eltTy = VTy ? VTy->getElementType() : Ty; | ||
911 | uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; | ||
912 | uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy); | ||
913 | diff --git a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp | ||
914 | index 84e481b7d..3acc4f305 100644 | ||
915 | --- a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp | ||
916 | +++ b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp | ||
917 | @@ -23,6 +23,7 @@ SPDX-License-Identifier: MIT | ||
918 | #include <llvm/IR/InstIterator.h> | ||
919 | #include <llvm/Support/Debug.h> | ||
920 | #include <llvm/Support/MathExtras.h> | ||
921 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
922 | #include "common/LLVMWarningsPop.hpp" | ||
923 | #include <vector> | ||
924 | #include "Probe/Assertion.h" | ||
925 | @@ -613,7 +614,7 @@ bool SLMConstProp::isEqual(Constant* C0, Constant* C1) | ||
926 | |||
927 | bool SLMConstProp::isFloatType(Type* Ty) | ||
928 | { | ||
929 | - if (VectorType * vTy = dyn_cast<VectorType>(Ty)) | ||
930 | + if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty)) | ||
931 | { | ||
932 | if (vTy->getNumElements() > 1) | ||
933 | { | ||
934 | diff --git a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp | ||
935 | index 33b711b94..0651d2c34 100644 | ||
936 | --- a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp | ||
937 | +++ b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp | ||
938 | @@ -50,7 +50,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I) | ||
939 | { | ||
940 | bool isNewTypeVector = false; | ||
941 | |||
942 | - VectorType* instType = cast<VectorType>(I.getType()); | ||
943 | + IGCLLVM::FixedVectorType* instType = cast<IGCLLVM::FixedVectorType>(I.getType()); | ||
944 | unsigned numElements = int_cast<unsigned>(instType->getNumElements()); | ||
945 | unsigned scalarSize = instType->getScalarSizeInBits(); | ||
946 | unsigned newScalarBits = numElements * scalarSize; | ||
947 | @@ -95,7 +95,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I) | ||
948 | } | ||
949 | else | ||
950 | { | ||
951 | - VectorType* newVecType = cast<VectorType>(newType); | ||
952 | + IGCLLVM::FixedVectorType* newVecType = cast<IGCLLVM::FixedVectorType>(newType); | ||
953 | unsigned newVecTypeNumEle = int_cast<unsigned>(newVecType->getNumElements()); | ||
954 | Value* ieLogicOp = UndefValue::get(newType); | ||
955 | for (unsigned i = 0; i < newVecTypeNumEle; i++) | ||
956 | diff --git a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp | ||
957 | index 14a68e0da..4f42a6770 100644 | ||
958 | --- a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp | ||
959 | +++ b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp | ||
960 | @@ -639,12 +639,14 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi | ||
961 | { | ||
962 | mpm.add(createPruneUnusedArgumentsPass()); | ||
963 | |||
964 | +#if LLVM_VERSION_MAJOR < 12 | ||
965 | if (IGC_GET_FLAG_VALUE(FunctionControl) == FLAG_FCALL_DEFAULT) | ||
966 | { | ||
967 | // Don't run IPConstantProp when debugging function calls, to avoid folding function arg/ret constants | ||
968 | mpm.add(createIPConstantPropagationPass()); | ||
969 | } | ||
970 | mpm.add(createConstantPropagationPass()); | ||
971 | +#endif | ||
972 | mpm.add(createDeadCodeEliminationPass()); | ||
973 | mpm.add(createCFGSimplificationPass()); | ||
974 | } | ||
975 | @@ -1549,8 +1551,10 @@ void OptimizeIR(CodeGenContext* const pContext) | ||
976 | // possible which potentially allows late stage code sinking of | ||
977 | // those calls by the instruction combiner. | ||
978 | mpm.add(createPostOrderFunctionAttrsLegacyPass()); | ||
979 | +#if LLVM_VERSION_MAJOR < 12 | ||
980 | mpm.add(createConstantPropagationPass()); | ||
981 | mpm.add(createIPConstantPropagationPass()); | ||
982 | +#endif | ||
983 | } | ||
984 | |||
985 | // enable this only when Pooled EU is not supported | ||
986 | diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp | ||
987 | index e1d1a8e60..97dbc0e74 100644 | ||
988 | --- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp | ||
989 | +++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp | ||
990 | @@ -12,8 +12,10 @@ SPDX-License-Identifier: MIT | ||
991 | #include "Compiler/CISACodeGen/Platform.hpp" | ||
992 | #include "common/LLVMWarningsPush.hpp" | ||
993 | #include <llvmWrapper/IR/DerivedTypes.h> | ||
994 | +#include <llvmWrapper/Transforms/Utils/LoopUtils.h> | ||
995 | #include <llvm/IR/InstIterator.h> | ||
996 | #include <llvm/IR/Operator.h> | ||
997 | +#include <llvmWrapper/IR/DerivedTypes.h> | ||
998 | #include "common/LLVMWarningsPop.hpp" | ||
999 | #include "GenISAIntrinsics/GenIntrinsics.h" | ||
1000 | #include "GenISAIntrinsics/GenIntrinsicInst.h" | ||
1001 | @@ -561,7 +563,7 @@ static bool isPayloadHeader(Value* V) { | ||
1002 | Argument* Arg = dyn_cast<Argument>(V); | ||
1003 | if (!Arg || !Arg->hasName()) | ||
1004 | return false; | ||
1005 | - VectorType* VTy = dyn_cast<VectorType>(Arg->getType()); | ||
1006 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType()); | ||
1007 | if (!VTy || VTy->getNumElements() != 8 || | ||
1008 | !VTy->getElementType()->isIntegerTy(32)) | ||
1009 | return false; | ||
1010 | @@ -572,7 +574,7 @@ static bool isR0(Value* V) { | ||
1011 | Argument* Arg = dyn_cast<Argument>(V); | ||
1012 | if (!Arg || !Arg->hasName()) | ||
1013 | return false; | ||
1014 | - VectorType* VTy = dyn_cast<VectorType>(Arg->getType()); | ||
1015 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType()); | ||
1016 | if (!VTy || VTy->getNumElements() != 8 || | ||
1017 | !VTy->getElementType()->isIntegerTy(32)) | ||
1018 | return false; | ||
1019 | @@ -583,7 +585,7 @@ static bool isEnqueuedLocalSize(Value* V) { | ||
1020 | Argument* Arg = dyn_cast<Argument>(V); | ||
1021 | if (!Arg || !Arg->hasName()) | ||
1022 | return false; | ||
1023 | - VectorType* VTy = dyn_cast<VectorType>(Arg->getType()); | ||
1024 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType()); | ||
1025 | if (!VTy || VTy->getNumElements() != 3 || | ||
1026 | !VTy->getElementType()->isIntegerTy(32)) | ||
1027 | return false; | ||
1028 | @@ -982,7 +984,7 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI) | ||
1029 | // Collect innermost simple loop. | ||
1030 | for (auto I = LI->begin(), E = LI->end(); I != E; ++I) { | ||
1031 | auto L = *I; | ||
1032 | - if (!L->empty()) | ||
1033 | + if (!IGCLLVM::isInnermost(L)) | ||
1034 | continue; | ||
1035 | if (L->getNumBlocks() != 2) | ||
1036 | continue; | ||
1037 | diff --git a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp | ||
1038 | index c42e8f373..a4f758a5a 100644 | ||
1039 | --- a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp | ||
1040 | +++ b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp | ||
1041 | @@ -336,7 +336,7 @@ static unsigned getLegalVectorSize(unsigned N) { | ||
1042 | // Check vector size. We may demote the data type if all values can fit into | ||
1043 | // smaller data type. | ||
1044 | // | ||
1045 | -static bool checkSize(GlobalVariable* GV, VectorType*& DataType, | ||
1046 | +static bool checkSize(GlobalVariable* GV, IGCLLVM::FixedVectorType*& DataType, | ||
1047 | bool& IsSigned) { | ||
1048 | Constant* Init = GV->getInitializer(); | ||
1049 | IGC_ASSERT(isa<ArrayType>(Init->getType())); | ||
1050 | @@ -344,7 +344,7 @@ static bool checkSize(GlobalVariable* GV, VectorType*& DataType, | ||
1051 | unsigned N = (unsigned)ArrayTy->getArrayNumElements(); | ||
1052 | Type* BaseTy = ArrayTy->getArrayElementType(); | ||
1053 | unsigned VectorSize = 1; | ||
1054 | - if (auto VT = dyn_cast<VectorType>(BaseTy)) { | ||
1055 | + if (auto VT = dyn_cast<IGCLLVM::FixedVectorType>(BaseTy)) { | ||
1056 | BaseTy = VT->getElementType(); | ||
1057 | VectorSize = int_cast<unsigned>(VT->getNumElements()); | ||
1058 | N *= VectorSize; | ||
1059 | @@ -467,7 +467,7 @@ static Constant* getConstantVal(Type* VEltTy, Constant* V, bool IsSigned) { | ||
1060 | return ConstantInt::get(VEltTy, IVal, IsSigned); | ||
1061 | } | ||
1062 | |||
1063 | -static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned, | ||
1064 | +static void promote(GlobalVariable* GV, IGCLLVM::FixedVectorType* AllocaType, bool IsSigned, | ||
1065 | Function* F) { | ||
1066 | // Build the constant vector from constant array. | ||
1067 | unsigned VS = int_cast<unsigned>(AllocaType->getNumElements()); | ||
1068 | @@ -491,7 +491,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned, | ||
1069 | Constant* const Elt = CA->getAggregateElement(i); | ||
1070 | IGC_ASSERT_MESSAGE(nullptr != Elt, "Null AggregateElement"); | ||
1071 | if (auto EltTy = dyn_cast<VectorType>(Elt->getType())) { | ||
1072 | - unsigned VectorSize = (unsigned)cast<VectorType>(EltTy)->getNumElements(); | ||
1073 | + unsigned VectorSize = (unsigned)cast<IGCLLVM::FixedVectorType>(EltTy)->getNumElements(); | ||
1074 | for (unsigned j = 0; j < VectorSize; ++j) { | ||
1075 | Constant* V = Elt->getAggregateElement(j); | ||
1076 | Vals[i * VectorSize + j] = getConstantVal(VEltTy, V, IsSigned); | ||
1077 | @@ -533,7 +533,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned, | ||
1078 | unsigned N = 1; | ||
1079 | Value* Offset = Index; | ||
1080 | if (Ty->isVectorTy()) { | ||
1081 | - N = (unsigned)cast<VectorType>(Ty)->getNumElements(); | ||
1082 | + N = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); | ||
1083 | Offset = Builder.CreateMul(Offset, ConstantInt::get(Offset->getType(), N)); | ||
1084 | } | ||
1085 | Value* Val = extractNElts(N, VectorData, Offset, Builder); | ||
1086 | @@ -668,7 +668,7 @@ bool PromoteConstant::runOnFunction(Function& F) { | ||
1087 | |||
1088 | // If possible demote the data into smaller type. Uses of value will be | ||
1089 | // promoted back with ZExt or SExt. | ||
1090 | - VectorType* AllocaType = nullptr; | ||
1091 | + IGCLLVM::FixedVectorType* AllocaType = nullptr; | ||
1092 | bool IsSigned = false; | ||
1093 | if (!checkSize(GV, AllocaType, IsSigned)) | ||
1094 | continue; | ||
1095 | diff --git a/IGC/Compiler/CISACodeGen/TypeDemote.cpp b/IGC/Compiler/CISACodeGen/TypeDemote.cpp | ||
1096 | index cd8f2eff0..e539bd6ed 100644 | ||
1097 | --- a/IGC/Compiler/CISACodeGen/TypeDemote.cpp | ||
1098 | +++ b/IGC/Compiler/CISACodeGen/TypeDemote.cpp | ||
1099 | @@ -16,6 +16,7 @@ SPDX-License-Identifier: MIT | ||
1100 | #include <llvm/ADT/PostOrderIterator.h> | ||
1101 | #include <llvm/IR/IRBuilder.h> | ||
1102 | #include <llvm/Pass.h> | ||
1103 | +#include <llvmWrapper/IR/DerivedTypes.h> | ||
1104 | #include "common/LLVMWarningsPop.hpp" | ||
1105 | #include "GenISAIntrinsics/GenIntrinsics.h" | ||
1106 | #include "Probe/Assertion.h" | ||
1107 | @@ -272,7 +273,7 @@ bool TypeDemote::demoteOnBasicBlock(BasicBlock* BB) const { | ||
1108 | CastInst* CI = dyn_cast<CastInst>(Index); | ||
1109 | if (CI && (CI->getOpcode() == Instruction::ZExt || | ||
1110 | CI->getOpcode() == Instruction::SExt)) { | ||
1111 | - unsigned VS = (unsigned)cast<VectorType>(EEI->getVectorOperandType())->getNumElements(); | ||
1112 | + unsigned VS = (unsigned)cast<IGCLLVM::FixedVectorType>(EEI->getVectorOperandType())->getNumElements(); | ||
1113 | unsigned N = (unsigned int)CI->getSrcTy()->getPrimitiveSizeInBits(); | ||
1114 | unsigned Bound = (N < 32) ? (1U << N) : UINT32_MAX; | ||
1115 | if (VS <= Bound) { | ||
1116 | diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp | ||
1117 | index 666eb62e3..8b44cfef3 100644 | ||
1118 | --- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp | ||
1119 | +++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp | ||
1120 | @@ -12,6 +12,7 @@ SPDX-License-Identifier: MIT | ||
1121 | #include "Compiler/CodeGenPublic.h" | ||
1122 | #include "common/LLVMWarningsPush.hpp" | ||
1123 | #include <llvm/Support/Debug.h> | ||
1124 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1125 | #include "common/LLVMWarningsPop.hpp" | ||
1126 | #include <algorithm> | ||
1127 | #include "Probe/Assertion.h" | ||
1128 | @@ -24,13 +25,13 @@ namespace | ||
1129 | // If V is scalar, return 1. | ||
1130 | // if V is vector, return the number of elements. | ||
1131 | inline int getNumElts(Value* V) { | ||
1132 | - VectorType* VTy = dyn_cast<VectorType>(V->getType()); | ||
1133 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(V->getType()); | ||
1134 | return VTy ? (int)VTy->getNumElements() : 1; | ||
1135 | } | ||
1136 | |||
1137 | inline int getTypeSizeInBits(Type* Ty) { | ||
1138 | int scalarBits = Ty->getScalarSizeInBits(); | ||
1139 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
1140 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
1141 | return scalarBits * (VTy ? (int)VTy->getNumElements() : 1); | ||
1142 | } | ||
1143 | } | ||
1144 | diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp | ||
1145 | index ca523f239..d16d286fa 100644 | ||
1146 | --- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp | ||
1147 | +++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp | ||
1148 | @@ -21,6 +21,7 @@ SPDX-License-Identifier: MIT | ||
1149 | #include <llvm/IR/InstIterator.h> | ||
1150 | #include <llvm/IR/InstVisitor.h> | ||
1151 | #include "llvm/Pass.h" | ||
1152 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1153 | #include "llvm/Support/raw_ostream.h" | ||
1154 | #include "common/LLVMWarningsPop.hpp" | ||
1155 | #include "Compiler/CISACodeGen/RegisterEstimator.hpp" | ||
1156 | @@ -63,7 +64,7 @@ namespace IGC { | ||
1157 | SSubVecDesc(llvm::Value* V) | ||
1158 | : Aliaser(V), BaseVector(V), StartElementOffset(0) | ||
1159 | { | ||
1160 | - llvm::VectorType* VTy = llvm::dyn_cast<llvm::VectorType>(V->getType()); | ||
1161 | + IGCLLVM::FixedVectorType* VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(V->getType()); | ||
1162 | NumElts = VTy ? (short)VTy->getNumElements() : 1; | ||
1163 | } | ||
1164 | |||
1165 | diff --git a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp | ||
1166 | index 204b2f29a..2ea975555 100644 | ||
1167 | --- a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp | ||
1168 | +++ b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp | ||
1169 | @@ -485,7 +485,7 @@ void VectorPreProcess::replaceAllVectorUsesWithScalars(Instruction* VI, ValVecto | ||
1170 | I = VI->getParent()->getFirstNonPHI(); | ||
1171 | } | ||
1172 | IRBuilder<> Builder(I); | ||
1173 | - VectorType* VTy = cast<VectorType>(VI->getType()); | ||
1174 | + IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(VI->getType()); | ||
1175 | Value* newVec = UndefValue::get(VTy); | ||
1176 | for (uint32_t i = 0, e = int_cast<uint32_t>(VTy->getNumElements()); i < e; ++i) | ||
1177 | { | ||
1178 | @@ -626,7 +626,7 @@ bool VectorPreProcess::splitStore( | ||
1179 | { | ||
1180 | Instruction* SI = ASI.getInst(); | ||
1181 | Value* StoredVal = ASI.getValueOperand(); | ||
1182 | - VectorType* VTy = cast<VectorType>(StoredVal->getType()); | ||
1183 | + IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(StoredVal->getType()); | ||
1184 | Type* ETy = VTy->getElementType(); | ||
1185 | uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements()); | ||
1186 | |||
1187 | @@ -712,7 +712,7 @@ bool VectorPreProcess::splitStore( | ||
1188 | { | ||
1189 | Type* Ty1 = splitInfo[i].first; | ||
1190 | uint32_t len1 = splitInfo[i].second; | ||
1191 | - VectorType* VTy1 = dyn_cast<VectorType>(Ty1); | ||
1192 | + IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1); | ||
1193 | for (uint32_t j = 0; j < len1; ++j) | ||
1194 | { | ||
1195 | Value* subVec; | ||
1196 | @@ -749,7 +749,7 @@ bool VectorPreProcess::splitStore( | ||
1197 | { | ||
1198 | Type* Ty1 = splitInfo[i].first; | ||
1199 | uint32_t len1 = splitInfo[i].second; | ||
1200 | - VectorType* VTy1 = dyn_cast<VectorType>(Ty1); | ||
1201 | + IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1); | ||
1202 | for (uint32_t j = 0; j < len1; ++j) | ||
1203 | { | ||
1204 | uint32_t vAlign = (uint32_t)MinAlign(Align, (uint32_t)eOffset * EBytes); | ||
1205 | @@ -793,7 +793,7 @@ bool VectorPreProcess::splitLoad( | ||
1206 | { | ||
1207 | Instruction* LI = ALI.getInst(); | ||
1208 | bool isLdRaw = isa<LdRawIntrinsic>(LI); | ||
1209 | - VectorType* VTy = cast<VectorType>(LI->getType()); | ||
1210 | + IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(LI->getType()); | ||
1211 | Type* ETy = VTy->getElementType(); | ||
1212 | uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements()); | ||
1213 | |||
1214 | @@ -855,7 +855,7 @@ bool VectorPreProcess::splitLoad( | ||
1215 | { | ||
1216 | Type* Ty1 = splitInfo[i].first; | ||
1217 | uint32_t len1 = splitInfo[i].second; | ||
1218 | - VectorType* VTy1 = dyn_cast<VectorType>(Ty1); | ||
1219 | + IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1); | ||
1220 | for (uint32_t j = 0; j < len1; ++j) | ||
1221 | { | ||
1222 | uint32_t vAlign = (uint32_t)MinAlign(Align, eOffset * EBytes); | ||
1223 | @@ -923,7 +923,7 @@ bool VectorPreProcess::splitLoadStore( | ||
1224 | Optional<AbstractStoreInst> ASI = AbstractStoreInst::get(Inst); | ||
1225 | IGC_ASSERT_MESSAGE((ALI || ASI), "Inst should be either load or store"); | ||
1226 | Type* Ty = ALI ? ALI->getInst()->getType() : ASI->getValueOperand()->getType(); | ||
1227 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
1228 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
1229 | if (!VTy) | ||
1230 | { | ||
1231 | return false; | ||
1232 | @@ -1154,7 +1154,7 @@ void VectorPreProcess::getOrGenScalarValues( | ||
1233 | { | ||
1234 | availBeforeInst = nullptr; | ||
1235 | |||
1236 | - VectorType* VTy = cast<VectorType>(VecVal->getType()); | ||
1237 | + IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(VecVal->getType()); | ||
1238 | if (!VTy) | ||
1239 | { | ||
1240 | scalars[0] = VecVal; | ||
1241 | @@ -1305,7 +1305,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst) | ||
1242 | // | ||
1243 | // TODO: further optimize this load into a message with channel masks | ||
1244 | // for cases in which use indices are sparse like {0, 2}. | ||
1245 | - unsigned N = (unsigned)cast<VectorType>(Inst->getType())->getNumElements(); | ||
1246 | + unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(Inst->getType())->getNumElements(); | ||
1247 | if (N == MaxIndex + 1) | ||
1248 | return Inst; | ||
1249 | |||
1250 | @@ -1420,7 +1420,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst) | ||
1251 | if (NBits < 32) | ||
1252 | return Inst; | ||
1253 | |||
1254 | - unsigned N = (unsigned)cast<VectorType>(Val->getType())->getNumElements(); | ||
1255 | + unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(Val->getType())->getNumElements(); | ||
1256 | if (auto CV = dyn_cast<ConstantVector>(Val)) | ||
1257 | { | ||
1258 | unsigned MaxIndex = 0; | ||
1259 | @@ -1589,7 +1589,7 @@ bool VectorPreProcess::runOnFunction(Function& F) | ||
1260 | for (uint32_t j = 0; j < svals.size(); ++j) | ||
1261 | { | ||
1262 | Type* Ty1 = svals[j]->getType(); | ||
1263 | - VectorType* VTy1 = dyn_cast<VectorType>(Ty1); | ||
1264 | + IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1); | ||
1265 | if (VTy1) { | ||
1266 | for (uint32_t k = 0; k < VTy1->getNumElements(); ++k) | ||
1267 | { | ||
1268 | @@ -1638,7 +1638,7 @@ bool VectorPreProcess::runOnFunction(Function& F) | ||
1269 | // If this is a 3-element vector load, remove it | ||
1270 | // from m_Vector3List as well. | ||
1271 | if (isAbstractLoadInst(tInst) && tInst->getType()->isVectorTy() && | ||
1272 | - cast<VectorType>(tInst->getType())->getNumElements() == 3) | ||
1273 | + cast<IGCLLVM::FixedVectorType>(tInst->getType())->getNumElements() == 3) | ||
1274 | { | ||
1275 | InstWorkVector::iterator | ||
1276 | tI = m_Vector3List.begin(), | ||
1277 | diff --git a/IGC/Compiler/CISACodeGen/VectorProcess.cpp b/IGC/Compiler/CISACodeGen/VectorProcess.cpp | ||
1278 | index c30a07834..8046b2e65 100644 | ||
1279 | --- a/IGC/Compiler/CISACodeGen/VectorProcess.cpp | ||
1280 | +++ b/IGC/Compiler/CISACodeGen/VectorProcess.cpp | ||
1281 | @@ -224,7 +224,7 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst) | ||
1282 | IGC_ASSERT(nullptr != Ptr); | ||
1283 | IGC_ASSERT(nullptr != Ty); | ||
1284 | |||
1285 | - VectorType* const VTy = dyn_cast<VectorType>(Ty); | ||
1286 | + IGCLLVM::FixedVectorType* const VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
1287 | |||
1288 | // Treat a scalar as 1-element vector | ||
1289 | uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; | ||
1290 | @@ -638,7 +638,7 @@ void VectorMessage::getInfo(Type* Ty, uint32_t Align, bool useA32, | ||
1291 | VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
1292 | Type* eTy = VTy ? cast<VectorType>(VTy)->getElementType() : Ty; | ||
1293 | unsigned eltSize = m_emitter->GetScalarTypeSizeInRegister(eTy); | ||
1294 | - unsigned nElts = VTy ? (unsigned)cast<VectorType>(VTy)->getNumElements() : 1; | ||
1295 | + unsigned nElts = VTy ? (unsigned)cast<IGCLLVM::FixedVectorType>(VTy)->getNumElements() : 1; | ||
1296 | // total bytes | ||
1297 | const unsigned TBytes = nElts * eltSize; | ||
1298 | |||
1299 | diff --git a/IGC/Compiler/CISACodeGen/helper.cpp b/IGC/Compiler/CISACodeGen/helper.cpp | ||
1300 | index f3da862c6..288a69a79 100644 | ||
1301 | --- a/IGC/Compiler/CISACodeGen/helper.cpp | ||
1302 | +++ b/IGC/Compiler/CISACodeGen/helper.cpp | ||
1303 | @@ -1744,7 +1744,7 @@ namespace IGC | ||
1304 | { | ||
1305 | instList[i] = builder.CreateExtractElement(val, static_cast<uint64_t>(0)); | ||
1306 | size_t iOld = i; | ||
1307 | - for (unsigned j = 1; j < cast<VectorType>(val->getType())->getNumElements(); j++) | ||
1308 | + for (unsigned j = 1; j < cast<IGCLLVM::FixedVectorType>(val->getType())->getNumElements(); j++) | ||
1309 | { | ||
1310 | instList.insert(instList.begin()+ iOld +j, builder.CreateExtractElement(val, j)); | ||
1311 | i++; | ||
1312 | @@ -1777,7 +1777,7 @@ namespace IGC | ||
1313 | } | ||
1314 | break; | ||
1315 | case IGCLLVM::VectorTyID: | ||
1316 | - num = (unsigned)cast<VectorType>(type)->getNumElements(); | ||
1317 | + num = (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements(); | ||
1318 | for (unsigned i = 0; i < num; i++) | ||
1319 | { | ||
1320 | ScalarizeAggregateMembers(builder, builder.CreateExtractElement(val, i), instList); | ||
1321 | @@ -1817,7 +1817,7 @@ namespace IGC | ||
1322 | } | ||
1323 | break; | ||
1324 | case IGCLLVM::VectorTyID: | ||
1325 | - num = (unsigned)cast<VectorType>(type)->getNumElements(); | ||
1326 | + num = (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements(); | ||
1327 | for (unsigned i = 0; i < num; i++) | ||
1328 | { | ||
1329 | indices.push_back(builder.getInt32(i)); | ||
1330 | @@ -2082,8 +2082,8 @@ namespace IGC | ||
1331 | return false; | ||
1332 | } | ||
1333 | |||
1334 | - VectorType* dVTy = dyn_cast<VectorType>(dTy); | ||
1335 | - VectorType* sVTy = dyn_cast<VectorType>(sTy); | ||
1336 | + IGCLLVM::FixedVectorType* dVTy = dyn_cast<IGCLLVM::FixedVectorType>(dTy); | ||
1337 | + IGCLLVM::FixedVectorType* sVTy = dyn_cast<IGCLLVM::FixedVectorType>(sTy); | ||
1338 | int d_nelts = dVTy ? (int)dVTy->getNumElements() : 1; | ||
1339 | int s_nelts = sVTy ? (int)sVTy->getNumElements() : 1; | ||
1340 | if (d_nelts != s_nelts) { | ||
1341 | diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | ||
1342 | index 75089a77e..efb27ae4e 100644 | ||
1343 | --- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | ||
1344 | +++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | ||
1345 | @@ -138,12 +138,11 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I) | ||
1346 | // There are uses of ldmcs other then ldms, using vector of int32 type. | ||
1347 | // Fix them to use newly created 16bit ldmcs. | ||
1348 | if (ldmcs->getType()->isVectorTy() && | ||
1349 | - cast<VectorType>(ldmcs->getType())->getElementType() == m_builder->getInt32Ty()) | ||
1350 | + cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getElementType()->isFloatTy()) | ||
1351 | { | ||
1352 | m_builder->SetInsertPoint(ldmcs); | ||
1353 | - | ||
1354 | - uint32_t ldmcsNumOfElements = (uint32_t)cast<VectorType>(ldmcs->getType())->getNumElements(); | ||
1355 | - uint32_t newLdmcsNumOfElements = (uint32_t)cast<VectorType>(new_mcs_call->getType())->getNumElements(); | ||
1356 | + uint32_t ldmcsNumOfElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements(); | ||
1357 | + uint32_t newLdmcsNumOfElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements(); | ||
1358 | |||
1359 | // vec of 16bit ints to vec of 32bit ints | ||
1360 | Type* newLdmcsVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), newLdmcsNumOfElements); | ||
1361 | diff --git a/IGC/Compiler/CustomSafeOptPass.cpp b/IGC/Compiler/CustomSafeOptPass.cpp | ||
1362 | index 3fe49f460..c65a466cc 100644 | ||
1363 | --- a/IGC/Compiler/CustomSafeOptPass.cpp | ||
1364 | +++ b/IGC/Compiler/CustomSafeOptPass.cpp | ||
1365 | @@ -1544,7 +1544,7 @@ void IGC::CustomSafeOptPass::visitSampleBptr(llvm::SampleIntrinsic* sampleInst) | ||
1366 | bool CustomSafeOptPass::isIdentityMatrix(ExtractElementInst& I) | ||
1367 | { | ||
1368 | bool found = false; | ||
1369 | - auto extractType = cast<VectorType>(I.getVectorOperandType()); | ||
1370 | + auto extractType = cast<IGCLLVM::FixedVectorType>(I.getVectorOperandType()); | ||
1371 | auto extractTypeVecSize = (uint32_t)extractType->getNumElements(); | ||
1372 | if (extractTypeVecSize == 20 || | ||
1373 | extractTypeVecSize == 16) | ||
1374 | @@ -1773,7 +1773,7 @@ void CustomSafeOptPass::visitExtractElementInst(ExtractElementInst& I) | ||
1375 | int elOffset = (int)(bitShift / eltSize); | ||
1376 | elOffset = rightShift ? elOffset : -elOffset; | ||
1377 | unsigned int newIndex = (unsigned int)((int)cstIndex->getZExtValue() + elOffset); | ||
1378 | - if (newIndex < cast<VectorType>(vecType)->getNumElements()) | ||
1379 | + if (newIndex < cast<IGCLLVM::FixedVectorType>(vecType)->getNumElements()) | ||
1380 | { | ||
1381 | IRBuilder<> builder(&I); | ||
1382 | Value* newBitCast = builder.CreateBitCast(binOp->getOperand(0), vecType); | ||
1383 | @@ -2173,7 +2173,7 @@ void GenSpecificPattern::createBitcastExtractInsertPattern(BinaryOperator& I, Va | ||
1384 | else if (auto IEIInst = dyn_cast<InsertElementInst>(Op)) | ||
1385 | { | ||
1386 | auto opType = IEIInst->getType(); | ||
1387 | - if (opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<VectorType>(opType)->getNumElements() == 2) | ||
1388 | + if (opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<IGCLLVM::FixedVectorType>(opType)->getNumElements() == 2) | ||
1389 | { | ||
1390 | elem = IEIInst->getOperand(1); | ||
1391 | } | ||
1392 | @@ -2236,7 +2236,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I) | ||
1393 | else if (match(&I, pattern2) && AndOp2->getType()->isIntegerTy(64)) | ||
1394 | { | ||
1395 | ConstantVector* cVec = dyn_cast<ConstantVector>(VecOp); | ||
1396 | - VectorType* vector_type = dyn_cast<VectorType>(VecOp->getType()); | ||
1397 | + IGCLLVM::FixedVectorType* vector_type = dyn_cast<IGCLLVM::FixedVectorType>(VecOp->getType()); | ||
1398 | if (cVec && vector_type && | ||
1399 | isa<ConstantInt>(cVec->getOperand(0)) && | ||
1400 | cast<ConstantInt>(cVec->getOperand(0))->isZero() && | ||
1401 | @@ -2382,7 +2382,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I) | ||
1402 | BitCastInst* opBC = cast<BitCastInst>(op); | ||
1403 | |||
1404 | auto opType = opBC->getType(); | ||
1405 | - if (!(opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<VectorType>(opType)->getNumElements() == 2)) | ||
1406 | + if (!(opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<IGCLLVM::FixedVectorType>(opType)->getNumElements() == 2)) | ||
1407 | return nullptr; | ||
1408 | |||
1409 | if (opBC->getSrcTy()->isDoubleTy()) | ||
1410 | @@ -2808,8 +2808,8 @@ void GenSpecificPattern::visitBitCastInst(BitCastInst& I) | ||
1411 | if (zExtInst->getOperand(0)->getType()->isIntegerTy(32) && | ||
1412 | isa<InsertElementInst>(bitCastInst->getOperand(0)) && | ||
1413 | bitCastInst->getOperand(0)->getType()->isVectorTy() && | ||
1414 | - cast<VectorType>(bitCastInst->getOperand(0)->getType())->getElementType()->isIntegerTy(32) && | ||
1415 | - cast<VectorType>(bitCastInst->getOperand(0)->getType())->getNumElements() == 2) | ||
1416 | + cast<IGCLLVM::FixedVectorType>(bitCastInst->getOperand(0)->getType())->getElementType()->isIntegerTy(32) && | ||
1417 | + cast<IGCLLVM::FixedVectorType>(bitCastInst->getOperand(0)->getType())->getNumElements() == 2) | ||
1418 | { | ||
1419 | InsertElementInst* insertElementInst = cast<InsertElementInst>(bitCastInst->getOperand(0)); | ||
1420 | |||
1421 | @@ -2979,7 +2979,7 @@ void GenSpecificPattern::visitFNeg(llvm::UnaryOperator& I) | ||
1422 | } | ||
1423 | else | ||
1424 | { | ||
1425 | - uint32_t vectorSize = cast<VectorType>(I.getType())->getNumElements(); | ||
1426 | + uint32_t vectorSize = cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements(); | ||
1427 | fsub = llvm::UndefValue::get(I.getType()); | ||
1428 | |||
1429 | for (uint32_t i = 0; i < vectorSize; ++i) | ||
1430 | @@ -3056,7 +3056,7 @@ Constant* IGCConstProp::replaceShaderConstant(Instruction* inst) | ||
1431 | if (inst->getType()->isVectorTy()) | ||
1432 | { | ||
1433 | Type* srcEltTy = cast<VectorType>(inst->getType())->getElementType(); | ||
1434 | - uint32_t srcNElts = (uint32_t)cast<VectorType>(inst->getType())->getNumElements(); | ||
1435 | + uint32_t srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements(); | ||
1436 | uint32_t eltSize_in_bytes = (unsigned int)srcEltTy->getPrimitiveSizeInBits() / 8; | ||
1437 | IRBuilder<> builder(inst); | ||
1438 | Value* vectorValue = UndefValue::get(inst->getType()); | ||
1439 | @@ -3341,7 +3341,7 @@ Constant* IGCConstProp::ConstantFoldCmpInst(CmpInst* CI) | ||
1440 | { | ||
1441 | bool AllTrue = true, AllFalse = true; | ||
1442 | auto VecOpnd = cast<Constant>(EEI->getVectorOperand()); | ||
1443 | - unsigned N = (unsigned)cast<VectorType>(VecOpnd->getType())->getNumElements(); | ||
1444 | + unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(VecOpnd->getType())->getNumElements(); | ||
1445 | for (unsigned i = 0; i < N; ++i) | ||
1446 | { | ||
1447 | Constant* const Opnd = VecOpnd->getAggregateElement(i); | ||
1448 | @@ -4137,8 +4137,8 @@ namespace IGC | ||
1449 | BitCastInst* BC = dyn_cast<BitCastInst>(&*BI++); | ||
1450 | if (!BC) continue; | ||
1451 | // Skip non-element-wise bitcast. | ||
1452 | - VectorType* DstVTy = dyn_cast<VectorType>(BC->getType()); | ||
1453 | - VectorType* SrcVTy = dyn_cast<VectorType>(BC->getOperand(0)->getType()); | ||
1454 | + IGCLLVM::FixedVectorType* DstVTy = dyn_cast<IGCLLVM::FixedVectorType>(BC->getType()); | ||
1455 | + IGCLLVM::FixedVectorType* SrcVTy = dyn_cast<IGCLLVM::FixedVectorType>(BC->getOperand(0)->getType()); | ||
1456 | if (!DstVTy || !SrcVTy || DstVTy->getNumElements() != SrcVTy->getNumElements()) | ||
1457 | continue; | ||
1458 | // Skip if it's not used only all extractelement. | ||
1459 | @@ -4928,7 +4928,7 @@ void SplitIndirectEEtoSel::visitExtractElementInst(llvm::ExtractElementInst& I) | ||
1460 | { | ||
1461 | using namespace llvm::PatternMatch; | ||
1462 | |||
1463 | - VectorType* vecTy = I.getVectorOperandType(); | ||
1464 | + IGCLLVM::FixedVectorType* vecTy = dyn_cast<IGCLLVM::FixedVectorType>(I.getVectorOperandType()); | ||
1465 | uint64_t num = vecTy->getNumElements(); | ||
1466 | Type* eleType = vecTy->getElementType(); | ||
1467 | |||
1468 | diff --git a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp | ||
1469 | index d094f36e7..b66f4585a 100644 | ||
1470 | --- a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp | ||
1471 | +++ b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp | ||
1472 | @@ -15,6 +15,7 @@ SPDX-License-Identifier: MIT | ||
1473 | #include "DebugInfo/DebugInfoUtils.hpp" | ||
1474 | |||
1475 | #include "common/LLVMWarningsPush.hpp" | ||
1476 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1477 | #include "llvm/IR/Function.h" | ||
1478 | #include "llvm/IR/Module.h" | ||
1479 | #include "common/LLVMWarningsPop.hpp" | ||
1480 | @@ -565,7 +566,7 @@ ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const | ||
1481 | |||
1482 | if (pType->isVectorTy()) | ||
1483 | { | ||
1484 | - vectorNumElements = (unsigned)cast<VectorType>(pType)->getNumElements(); | ||
1485 | + vectorNumElements = (unsigned)cast<IGCLLVM::FixedVectorType>(pType)->getNumElements(); | ||
1486 | } | ||
1487 | else if (!pVar->IsUniform()) | ||
1488 | { | ||
1489 | diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp | ||
1490 | index d51396080..8a74ec287 100644 | ||
1491 | --- a/IGC/Compiler/GenTTI.cpp | ||
1492 | +++ b/IGC/Compiler/GenTTI.cpp | ||
1493 | @@ -21,6 +21,7 @@ SPDX-License-Identifier: MIT | ||
1494 | #include "llvm/Analysis/LoopInfo.h" | ||
1495 | #include "llvm/Analysis/ScalarEvolution.h" | ||
1496 | #include "llvm/Support/raw_ostream.h" | ||
1497 | +#include "llvmWrapper/Transforms/Utils/LoopUtils.h" | ||
1498 | #include "common/LLVMWarningsPop.hpp" | ||
1499 | |||
1500 | using namespace llvm; | ||
1501 | @@ -201,7 +202,7 @@ namespace llvm { | ||
1502 | |||
1503 | // Skip non-simple loop. | ||
1504 | if (L->getNumBlocks() != 1) { | ||
1505 | - if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && L->empty()) { | ||
1506 | + if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && IGCLLVM::isInnermost(L)) { | ||
1507 | auto countNonPHI = [](BasicBlock* BB) { | ||
1508 | unsigned Total = BB->size(); | ||
1509 | unsigned PHIs = 0; | ||
1510 | diff --git a/IGC/Compiler/GenUpdateCB.cpp b/IGC/Compiler/GenUpdateCB.cpp | ||
1511 | index f15738472..d83ced93e 100644 | ||
1512 | --- a/IGC/Compiler/GenUpdateCB.cpp | ||
1513 | +++ b/IGC/Compiler/GenUpdateCB.cpp | ||
1514 | @@ -8,6 +8,7 @@ SPDX-License-Identifier: MIT | ||
1515 | |||
1516 | #include "common/LLVMWarningsPush.hpp" | ||
1517 | #include "llvmWrapper/Bitcode/BitcodeWriter.h" | ||
1518 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1519 | #include <llvm/Support/ScaledNumber.h> | ||
1520 | #include <llvm/Bitcode/BitcodeReader.h> | ||
1521 | #include "llvm/IR/DebugInfo.h" | ||
1522 | @@ -368,7 +369,7 @@ bool GenUpdateCB::runOnFunction(Function& F) | ||
1523 | isResInfo(dyn_cast<GenIntrinsicInst>(inst, | ||
1524 | GenISAIntrinsic::GenISA_resinfoptr), texId, lod, isUAV)) | ||
1525 | { | ||
1526 | - unsigned nelems = (unsigned)cast<VectorType>(inst->getType())->getNumElements(); | ||
1527 | + unsigned nelems = (unsigned)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements(); | ||
1528 | SmallVector< SmallVector<ExtractElementInst*, 1>, 4> extracts(nelems); | ||
1529 | if (VectorUsedByConstExtractOnly(inst, extracts)) | ||
1530 | { | ||
1531 | diff --git a/IGC/Compiler/HandleFRemInstructions.cpp b/IGC/Compiler/HandleFRemInstructions.cpp | ||
1532 | index 6b48f0b28..8025667f1 100644 | ||
1533 | --- a/IGC/Compiler/HandleFRemInstructions.cpp | ||
1534 | +++ b/IGC/Compiler/HandleFRemInstructions.cpp | ||
1535 | @@ -12,6 +12,7 @@ SPDX-License-Identifier: MIT | ||
1536 | #include <llvm/IR/Instructions.h> | ||
1537 | #include <llvm/IR/InstIterator.h> | ||
1538 | #include <llvm/Transforms/Utils/BasicBlockUtils.h> | ||
1539 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1540 | #include "common/LLVMWarningsPop.hpp" | ||
1541 | #include "Compiler/IGCPassSupport.h" | ||
1542 | #include "Probe/Assertion.h" | ||
1543 | @@ -61,7 +62,7 @@ void HandleFRemInstructions::visitFRem(llvm::BinaryOperator& I) | ||
1544 | |||
1545 | if (ValType->isVectorTy()) | ||
1546 | { | ||
1547 | - auto VecCount = cast<VectorType>(ValType)->getNumElements(); | ||
1548 | + auto VecCount = cast<IGCLLVM::FixedVectorType>(ValType)->getNumElements(); | ||
1549 | if (VecCount == 2 || VecCount == 3 || VecCount == 4 || VecCount == 8 || VecCount == 16) | ||
1550 | { | ||
1551 | VecStr = "v" + std::to_string(VecCount); | ||
1552 | diff --git a/IGC/Compiler/HandleLoadStoreInstructions.cpp b/IGC/Compiler/HandleLoadStoreInstructions.cpp | ||
1553 | index 40e9930b5..8c2e60018 100644 | ||
1554 | --- a/IGC/Compiler/HandleLoadStoreInstructions.cpp | ||
1555 | +++ b/IGC/Compiler/HandleLoadStoreInstructions.cpp | ||
1556 | @@ -61,7 +61,7 @@ void HandleLoadStoreInstructions::visitLoadInst(llvm::LoadInst& I) | ||
1557 | |||
1558 | if (I.getType()->isVectorTy()) | ||
1559 | { | ||
1560 | - numVectorElements = (uint32_t)cast<VectorType>(I.getType())->getNumElements(); | ||
1561 | + numVectorElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements(); | ||
1562 | doubleDstType = IGCLLVM::FixedVectorType::get(builder.getDoubleTy(), numVectorElements); | ||
1563 | } | ||
1564 | uint as = ptrv->getType()->getPointerAddressSpace(); | ||
1565 | @@ -134,7 +134,7 @@ void HandleLoadStoreInstructions::visitStoreInst(llvm::StoreInst& I) | ||
1566 | |||
1567 | if (I.getValueOperand()->getType()->isVectorTy()) | ||
1568 | { | ||
1569 | - numVectorElements = (uint32_t)cast<VectorType>(I.getValueOperand()->getType())->getNumElements(); | ||
1570 | + numVectorElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(I.getValueOperand()->getType())->getNumElements(); | ||
1571 | } | ||
1572 | |||
1573 | |||
1574 | diff --git a/IGC/Compiler/LegalizationPass.cpp b/IGC/Compiler/LegalizationPass.cpp | ||
1575 | index bc03b251d..aa63e2b92 100644 | ||
1576 | --- a/IGC/Compiler/LegalizationPass.cpp | ||
1577 | +++ b/IGC/Compiler/LegalizationPass.cpp | ||
1578 | @@ -671,7 +671,7 @@ void Legalization::visitBitCastInst(llvm::BitCastInst& I) | ||
1579 | if (!isa<TruncInst>(pZ->getOperand(0))) | ||
1580 | return; | ||
1581 | |||
1582 | - auto* pVecTy = cast<VectorType>(pZ->getDestTy()); | ||
1583 | + auto* pVecTy = cast<IGCLLVM::FixedVectorType>(pZ->getDestTy()); | ||
1584 | if (pVecTy->getNumElements() != 3) | ||
1585 | return; | ||
1586 | |||
1587 | @@ -766,7 +766,7 @@ void Legalization::visitSelectInst(SelectInst& I) | ||
1588 | } | ||
1589 | else if (I.getType()->isVectorTy()) | ||
1590 | { | ||
1591 | - unsigned int vecSize = (unsigned)cast<VectorType>(I.getType())->getNumElements(); | ||
1592 | + unsigned int vecSize = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements(); | ||
1593 | Value* newVec = UndefValue::get(I.getType()); | ||
1594 | m_builder->SetInsertPoint(&I); | ||
1595 | for (unsigned int i = 0; i < vecSize; i++) | ||
1596 | @@ -1148,7 +1148,7 @@ void Legalization::visitStoreInst(StoreInst& I) | ||
1597 | if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0))) | ||
1598 | { | ||
1599 | Value* newVec = UndefValue::get(vec->getType()); | ||
1600 | - unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements(); | ||
1601 | + unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements(); | ||
1602 | for (unsigned int i = 0; i < nbElement; i++) | ||
1603 | { | ||
1604 | Constant* cst = vec->getElementAsConstant(i); | ||
1605 | @@ -1168,7 +1168,7 @@ void Legalization::visitStoreInst(StoreInst& I) | ||
1606 | else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0))) | ||
1607 | { | ||
1608 | Value* newVec = UndefValue::get(vec->getType()); | ||
1609 | - unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements(); | ||
1610 | + unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements(); | ||
1611 | for (unsigned int i = 0; i < nbElement; i++) | ||
1612 | { | ||
1613 | Constant* cst = vec->getOperand(i); | ||
1614 | @@ -1188,7 +1188,7 @@ void Legalization::visitStoreInst(StoreInst& I) | ||
1615 | else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0))) | ||
1616 | { | ||
1617 | Value* newVec = UndefValue::get(vec->getType()); | ||
1618 | - unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements(); | ||
1619 | + unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements(); | ||
1620 | for (unsigned int i = 0; i < nbElement; i++) | ||
1621 | { | ||
1622 | Constant* cst = vec->getElementValue(i); | ||
1623 | @@ -1338,7 +1338,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I) | ||
1624 | if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0))) | ||
1625 | { | ||
1626 | Value* newVec = UndefValue::get(vec->getType()); | ||
1627 | - unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements(); | ||
1628 | + unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements(); | ||
1629 | for (unsigned int i = 0; i < nbElement; i++) | ||
1630 | { | ||
1631 | Constant* cst = vec->getElementAsConstant(i); | ||
1632 | @@ -1358,7 +1358,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I) | ||
1633 | else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0))) | ||
1634 | { | ||
1635 | Value* newVec = UndefValue::get(I.getType()); | ||
1636 | - unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements(); | ||
1637 | + unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements(); | ||
1638 | for (unsigned int i = 0; i < nbElement; i++) | ||
1639 | { | ||
1640 | Constant* cst = vec->getOperand(i); | ||
1641 | @@ -1378,7 +1378,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I) | ||
1642 | else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0))) | ||
1643 | { | ||
1644 | Value* newVec = UndefValue::get(I.getType()); | ||
1645 | - unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements(); | ||
1646 | + unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements(); | ||
1647 | for (unsigned int i = 0; i < nbElement; i++) | ||
1648 | { | ||
1649 | Constant* cst = vec->getElementValue(i); | ||
1650 | @@ -1395,7 +1395,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I) | ||
1651 | else if (I.getOperand(1)->getType()->isIntegerTy(1)) | ||
1652 | { | ||
1653 | // This promotes i1 insertelement to i32 | ||
1654 | - unsigned int nbElement = (unsigned)cast<VectorType>(I.getOperand(0)->getType())->getNumElements(); | ||
1655 | + unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getOperand(0)->getType())->getNumElements(); | ||
1656 | Value* newVec = UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), nbElement)); | ||
1657 | PromoteInsertElement(&I, newVec); | ||
1658 | } | ||
1659 | @@ -1408,7 +1408,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I) | ||
1660 | // If the original vector is a constant, just use the scalar constant, | ||
1661 | // otherwise extract from the original vector. | ||
1662 | |||
1663 | - VectorType* resType = cast<VectorType>(I.getType()); | ||
1664 | + IGCLLVM::FixedVectorType* resType = cast<IGCLLVM::FixedVectorType>(I.getType()); | ||
1665 | Value* newVec = UndefValue::get(resType); | ||
1666 | Value* src0 = I.getOperand(0); | ||
1667 | Value* src1 = I.getOperand(1); | ||
1668 | @@ -1419,7 +1419,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I) | ||
1669 | Constant* mask = I.getShuffleMaskForBitcode(); | ||
1670 | #endif | ||
1671 | // The two inputs are guaranteed to be of the same type | ||
1672 | - VectorType* inType = cast<VectorType>(src0->getType()); | ||
1673 | + IGCLLVM::FixedVectorType* inType = cast<IGCLLVM::FixedVectorType>(src0->getType()); | ||
1674 | int inCount = int_cast<int>(inType->getNumElements()); | ||
1675 | int inBase = 2; // 2 means using undef | ||
1676 | // if inType == resType, use src0/src1 as the input | ||
1677 | @@ -1635,7 +1635,7 @@ Type* Legalization::LegalAllocaType(Type* type) const | ||
1678 | #endif | ||
1679 | legalType = IGCLLVM::FixedVectorType::get( | ||
1680 | LegalAllocaType(cast<VectorType>(type)->getElementType()), | ||
1681 | - (unsigned)cast<VectorType>(type)->getNumElements()); | ||
1682 | + (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements()); | ||
1683 | break; | ||
1684 | case Type::StructTyID: | ||
1685 | return LegalStructAllocaType(type); | ||
1686 | @@ -1976,7 +1976,7 @@ void Legalization::visitIntrinsicInst(llvm::IntrinsicInst& I) | ||
1687 | Value* newValue = nullptr; | ||
1688 | if (srcType->isVectorTy()) | ||
1689 | { | ||
1690 | - auto sourceVT = cast<VectorType>(srcType); | ||
1691 | + auto sourceVT = cast<IGCLLVM::FixedVectorType>(srcType); | ||
1692 | const unsigned int numElements = (uint32_t)sourceVT->getNumElements(); | ||
1693 | Value* dstVec = UndefValue::get(srcType); | ||
1694 | for (unsigned int i = 0; i < numElements; ++i) | ||
1695 | @@ -2119,7 +2119,7 @@ void Legalization::visitTruncInst(llvm::TruncInst& I) { | ||
1696 | } | ||
1697 | |||
1698 | Src = BC->getOperand(0); | ||
1699 | - VectorType* VTy = dyn_cast<VectorType>(Src->getType()); | ||
1700 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Src->getType()); | ||
1701 | // Bail out if it's not bitcasted from <3 x i16> | ||
1702 | if (!VTy || VTy->getNumElements() != 3 || !VTy->getElementType()->isIntegerTy(16)) | ||
1703 | return; | ||
1704 | diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp | ||
1705 | index 56c0b9981..6d1778b61 100644 | ||
1706 | --- a/IGC/Compiler/Legalizer/InstPromoter.cpp | ||
1707 | +++ b/IGC/Compiler/Legalizer/InstPromoter.cpp | ||
1708 | @@ -382,7 +382,7 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) { | ||
1709 | IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N)); | ||
1710 | |||
1711 | std::vector<Constant*> Vals; | ||
1712 | - for (unsigned i = 0; i < (unsigned)cast<VectorType>(DestTy)->getNumElements(); i++) | ||
1713 | + for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements(); i++) | ||
1714 | Vals.push_back(IRB->getInt32(i)); | ||
1715 | |||
1716 | Value* Mask = ConstantVector::get(Vals); | ||
1717 | diff --git a/IGC/Compiler/Legalizer/InstScalarizer.cpp b/IGC/Compiler/Legalizer/InstScalarizer.cpp | ||
1718 | index c2b3f7ba7..2e519eef0 100644 | ||
1719 | --- a/IGC/Compiler/Legalizer/InstScalarizer.cpp | ||
1720 | +++ b/IGC/Compiler/Legalizer/InstScalarizer.cpp | ||
1721 | @@ -114,7 +114,7 @@ bool InstScalarizer::visitLoadInst(LoadInst& I) { | ||
1722 | // otherwise, it's broken. | ||
1723 | IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy)); | ||
1724 | |||
1725 | - unsigned NumElts = (unsigned)cast<VectorType>(OrigTy)->getNumElements(); | ||
1726 | + unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(OrigTy)->getNumElements(); | ||
1727 | unsigned Elt = 0; | ||
1728 | |||
1729 | Type* NewPtrTy = PointerType::get(EltTy, AS); | ||
1730 | @@ -252,7 +252,7 @@ bool InstScalarizer::visitStoreInst(StoreInst& I) { | ||
1731 | // otherwise, it's broken. | ||
1732 | IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy)); | ||
1733 | |||
1734 | - unsigned NumElts = (unsigned)cast<VectorType>(OrigTy)->getNumElements(); | ||
1735 | + unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(OrigTy)->getNumElements(); | ||
1736 | unsigned Elt = 0; | ||
1737 | |||
1738 | Type* NewPtrTy = PointerType::get(EltTy, AS); | ||
1739 | @@ -482,7 +482,7 @@ bool InstScalarizer::visitInsertElementInst(InsertElementInst& I) { | ||
1740 | IGC_ASSERT(EltSeq->size()); | ||
1741 | IGC_ASSERT(VecSeqCopy.size() % EltSeq->size() == 0); | ||
1742 | |||
1743 | - unsigned NumElts = (unsigned)cast<VectorType>(I.getOperand(0)->getType())->getNumElements(); | ||
1744 | + unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getOperand(0)->getType())->getNumElements(); | ||
1745 | unsigned i = 0; | ||
1746 | for (unsigned Elt = 0; Elt != NumElts; ++Elt) { | ||
1747 | if (Elt == Idx) { | ||
1748 | diff --git a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp | ||
1749 | index 5257de424..7d93665dc 100644 | ||
1750 | --- a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp | ||
1751 | +++ b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp | ||
1752 | @@ -146,7 +146,7 @@ void PeepholeTypeLegalizer::legalizePhiInstruction(Instruction& I) | ||
1753 | |||
1754 | if (quotient > 1) | ||
1755 | { | ||
1756 | - unsigned numElements = I.getType()->isVectorTy() ? (unsigned)cast<VectorType>(I.getType())->getNumElements() : 1; | ||
1757 | + unsigned numElements = I.getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements() : 1; | ||
1758 | Type* newType = IGCLLVM::FixedVectorType::get(Type::getIntNTy(I.getContext(), promoteToInt), quotient * numElements); | ||
1759 | |||
1760 | PHINode* newPhi = m_builder->CreatePHI(newType, oldPhi->getNumIncomingValues()); | ||
1761 | @@ -207,7 +207,7 @@ void PeepholeTypeLegalizer::legalizeExtractElement(Instruction& I) | ||
1762 | unsigned elementWidth = extract->getType()->getScalarSizeInBits(); | ||
1763 | if (!isLegalInteger(elementWidth) && extract->getType()->isIntOrIntVectorTy()) | ||
1764 | { | ||
1765 | - unsigned numElements = (unsigned)cast<VectorType>(extract->getOperand(0)->getType())->getNumElements(); | ||
1766 | + unsigned numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(extract->getOperand(0)->getType())->getNumElements(); | ||
1767 | unsigned quotient, promoteToInt; | ||
1768 | promoteInt(elementWidth, quotient, promoteToInt, DL->getLargestLegalIntTypeSizeInBits()); | ||
1769 | |||
1770 | @@ -834,7 +834,7 @@ void PeepholeTypeLegalizer::cleanupZExtInst(Instruction& I) { | ||
1771 | } | ||
1772 | |||
1773 | unsigned ipElmtSize = prevInst->getOperand(0)->getType()->getScalarSizeInBits(); | ||
1774 | - unsigned ipVecSize = (unsigned)cast<VectorType>(prevInst->getOperand(0)->getType())->getNumElements(); | ||
1775 | + unsigned ipVecSize = (unsigned)cast<IGCLLVM::FixedVectorType>(prevInst->getOperand(0)->getType())->getNumElements(); | ||
1776 | unsigned convFactor = promoteToInt / ipElmtSize; | ||
1777 | |||
1778 | Value* vecRes = UndefValue::get(IGCLLVM::FixedVectorType::get(llvm::Type::getIntNTy(I.getContext(), promoteToInt), quotient)); | ||
1779 | diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.cpp b/IGC/Compiler/Legalizer/TypeLegalizer.cpp | ||
1780 | index 6dfdae07e..03f866f14 100644 | ||
1781 | --- a/IGC/Compiler/Legalizer/TypeLegalizer.cpp | ||
1782 | +++ b/IGC/Compiler/Legalizer/TypeLegalizer.cpp | ||
1783 | @@ -16,6 +16,7 @@ SPDX-License-Identifier: MIT | ||
1784 | #include "InstScalarizer.h" | ||
1785 | #include "InstElementizer.h" | ||
1786 | #include "common/LLVMWarningsPush.hpp" | ||
1787 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1788 | #include "llvm/ADT/PostOrderIterator.h" | ||
1789 | #include "llvm/IR/CFG.h" | ||
1790 | #include "llvm/Support/Debug.h" | ||
1791 | @@ -274,7 +275,7 @@ TypeSeq* TypeLegalizer::getScalarizedTypeSeq(Type* Ty) { | ||
1792 | } | ||
1793 | |||
1794 | Type* EltTy = cast<VectorType>(Ty)->getElementType(); | ||
1795 | - for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i) | ||
1796 | + for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i) | ||
1797 | TMI->second.push_back(EltTy); | ||
1798 | |||
1799 | return &TMI->second; | ||
1800 | diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.h b/IGC/Compiler/Legalizer/TypeLegalizer.h | ||
1801 | index b51f00ac7..ee6d41992 100644 | ||
1802 | --- a/IGC/Compiler/Legalizer/TypeLegalizer.h | ||
1803 | +++ b/IGC/Compiler/Legalizer/TypeLegalizer.h | ||
1804 | @@ -12,6 +12,7 @@ SPDX-License-Identifier: MIT | ||
1805 | #include "llvmWrapper/IR/Instructions.h" | ||
1806 | #include "llvmWrapper/Analysis/InlineCost.h" | ||
1807 | #include "llvmWrapper/IR/InstrTypes.h" | ||
1808 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1809 | #include "llvmWrapper/Support/Alignment.h" | ||
1810 | #include "llvm/ADT/ArrayRef.h" | ||
1811 | #include "llvm/ADT/DenseMap.h" | ||
1812 | @@ -271,7 +272,7 @@ namespace IGC { | ||
1813 | if (!Ty->isVectorTy()) | ||
1814 | return false; | ||
1815 | |||
1816 | - unsigned NumElts = (unsigned)cast<VectorType>(Ty)->getNumElements(); | ||
1817 | + unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); | ||
1818 | Type* EltTy = cast<VectorType>(Ty)->getElementType(); | ||
1819 | const auto& ProfitLengths = getProfitLoadVectorLength(EltTy); | ||
1820 | |||
1821 | diff --git a/IGC/Compiler/LowPrecisionOptPass.cpp b/IGC/Compiler/LowPrecisionOptPass.cpp | ||
1822 | index b7a1474f4..e3d65bc18 100644 | ||
1823 | --- a/IGC/Compiler/LowPrecisionOptPass.cpp | ||
1824 | +++ b/IGC/Compiler/LowPrecisionOptPass.cpp | ||
1825 | @@ -253,7 +253,7 @@ bool LowPrecisionOpt::propagateSamplerType(llvm::GenIntrinsicInst& I) | ||
1826 | |||
1827 | if (I.getType()->isVectorTy()) | ||
1828 | { | ||
1829 | - numberOfElements = int_cast<unsigned int>(cast<VectorType>(I.getType())->getNumElements()); | ||
1830 | + numberOfElements = int_cast<unsigned int>(cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements()); | ||
1831 | } | ||
1832 | |||
1833 | llvm::SmallVector<llvm::Type*, 4> overloadTys; | ||
1834 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp | ||
1835 | index b22e14bd5..a2b5927ea 100644 | ||
1836 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp | ||
1837 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp | ||
1838 | @@ -7,6 +7,7 @@ SPDX-License-Identifier: MIT | ||
1839 | ============================= end_copyright_notice ===========================*/ | ||
1840 | |||
1841 | #include "llvm/Config/llvm-config.h" | ||
1842 | +#include <llvm/Analysis/TargetLibraryInfo.h> | ||
1843 | #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h" | ||
1844 | #include "Compiler/CodeGenPublic.h" | ||
1845 | #include "Compiler/IGCPassSupport.h" | ||
1846 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp | ||
1847 | index 0edacda24..7c0e7936d 100644 | ||
1848 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp | ||
1849 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp | ||
1850 | @@ -8,6 +8,7 @@ SPDX-License-Identifier: MIT | ||
1851 | |||
1852 | #include "Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.hpp" | ||
1853 | #include "Compiler/IGCPassSupport.h" | ||
1854 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1855 | #include "common/LLVMWarningsPush.hpp" | ||
1856 | #include "llvm/IR/Function.h" | ||
1857 | #include "common/LLVMWarningsPop.hpp" | ||
1858 | @@ -114,7 +115,7 @@ static uint64_t getNumElements(Type* type) | ||
1859 | { | ||
1860 | return arrayType->getNumElements(); | ||
1861 | } | ||
1862 | - if (VectorType * vectorType = dyn_cast<VectorType>(type)) | ||
1863 | + if (IGCLLVM::FixedVectorType * vectorType = dyn_cast<IGCLLVM::FixedVectorType>(type)) | ||
1864 | { | ||
1865 | return vectorType->getNumElements(); | ||
1866 | } | ||
1867 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp | ||
1868 | index 68b188d0b..ecc1b648a 100644 | ||
1869 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp | ||
1870 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp | ||
1871 | @@ -11,6 +11,7 @@ SPDX-License-Identifier: MIT | ||
1872 | #include "Compiler/IGCPassSupport.h" | ||
1873 | #include "GenISAIntrinsics/GenIntrinsicInst.h" | ||
1874 | |||
1875 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1876 | #include "common/LLVMWarningsPush.hpp" | ||
1877 | #include <llvm/IR/Function.h> | ||
1878 | #include <llvm/IR/Instructions.h> | ||
1879 | @@ -117,7 +118,7 @@ Value* CorrectlyRoundedDivSqrt::emitIEEEDivide(BinaryOperator* I, Value* Op0, Va | ||
1880 | } | ||
1881 | else | ||
1882 | { | ||
1883 | - auto vType = dyn_cast<VectorType>(Ty); | ||
1884 | + auto vType = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
1885 | unsigned VecLen = (uint32_t)vType->getNumElements(); | ||
1886 | Divide = UndefValue::get(Ty); | ||
1887 | for (unsigned i = 0; i < VecLen; i++) | ||
1888 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp | ||
1889 | index 387350066..86673d224 100644 | ||
1890 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp | ||
1891 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp | ||
1892 | @@ -937,7 +937,7 @@ namespace //Anonymous | ||
1893 | { | ||
1894 | auto ndrangeStructName = "struct.ndrange_t"; | ||
1895 | auto module = _deviceExecCall->getModule(); | ||
1896 | - auto ndrangeTy = module->getTypeByName(ndrangeStructName); | ||
1897 | + auto ndrangeTy = IGCLLVM::getTypeByName(module, ndrangeStructName); | ||
1898 | if (ndrangeTy == nullptr) | ||
1899 | { | ||
1900 | //create struct type | ||
1901 | @@ -1682,7 +1682,7 @@ namespace //Anonymous | ||
1902 | // this generates <element_type><num_elements> string. Ie for char2 element_type is char and num_elements is 2 | ||
1903 | // that is done by callin BaseTypeName on vector element type, this recursive call has only a depth of one since | ||
1904 | // there are no compound vectors in OpenCL. | ||
1905 | - auto vType = llvm::dyn_cast<VectorType>(type); | ||
1906 | + auto vType = llvm::dyn_cast<IGCLLVM::FixedVectorType>(type); | ||
1907 | return BaseTypeName(type->getContainedType(0), os) << vType->getNumElements(); | ||
1908 | } | ||
1909 | default: | ||
1910 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp | ||
1911 | index 4a7ce70b4..0178f4652 100644 | ||
1912 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp | ||
1913 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp | ||
1914 | @@ -8,6 +8,7 @@ SPDX-License-Identifier: MIT | ||
1915 | |||
1916 | #include "Compiler/Optimizer/OpenCLPasses/KernelArgs.hpp" | ||
1917 | #include "AdaptorCommon/ImplicitArgs.hpp" | ||
1918 | +#include "llvmWrapper/IR/DerivedTypes.h" | ||
1919 | #include "common/LLVMWarningsPush.hpp" | ||
1920 | #include <llvm/IR/Argument.h> | ||
1921 | #include <llvm/IR/DataLayout.h> | ||
1922 | @@ -372,7 +373,7 @@ unsigned int KernelArg::calcAssociatedArgNo(const ImplicitArg& implicitArg, cons | ||
1923 | |||
1924 | unsigned int KernelArg::getNumComponents() const | ||
1925 | { | ||
1926 | - if (VectorType * vecType = dyn_cast<VectorType>(m_arg->getType())) | ||
1927 | + if (IGCLLVM::FixedVectorType * vecType = dyn_cast<IGCLLVM::FixedVectorType>(m_arg->getType())) | ||
1928 | { | ||
1929 | // Vector | ||
1930 | return int_cast<unsigned int>(vecType->getNumElements()); | ||
1931 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp | ||
1932 | index 92c534a10..711fb6b01 100644 | ||
1933 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp | ||
1934 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp | ||
1935 | @@ -723,7 +723,7 @@ Value* OpenCLPrintfResolution::fixupPrintfArg(CallInst& printfCall, Value* arg, | ||
1936 | } | ||
1937 | |||
1938 | Type* newType = Type::getFloatTy(arg->getContext()); | ||
1939 | - if (auto argVT = dyn_cast<VectorType>(arg->getType())) | ||
1940 | + if (auto argVT = dyn_cast<IGCLLVM::FixedVectorType>(arg->getType())) | ||
1941 | { | ||
1942 | newType = IGCLLVM::FixedVectorType::get(newType, (unsigned)argVT->getNumElements()); | ||
1943 | } | ||
1944 | @@ -753,7 +753,7 @@ void OpenCLPrintfResolution::preprocessPrintfArgs(CallInst& printfCall) | ||
1945 | IGC::SHADER_PRINTF_TYPE argDataType = getPrintfArgDataType(arg); | ||
1946 | arg = fixupPrintfArg(printfCall, arg, argDataType); | ||
1947 | uint vecSize = 0; | ||
1948 | - if (auto argVType = dyn_cast<VectorType>(argType)) { | ||
1949 | + if (auto argVType = dyn_cast<IGCLLVM::FixedVectorType>(argType)) { | ||
1950 | vecSize = (uint)argVType->getNumElements(); | ||
1951 | } | ||
1952 | m_argDescriptors.push_back(SPrintfArgDescriptor(argDataType, arg, vecSize)); | ||
1953 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp | ||
1954 | index ac14b2d04..48c7e8637 100644 | ||
1955 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp | ||
1956 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp | ||
1957 | @@ -618,7 +618,7 @@ public: | ||
1958 | Type* scalarptrTy = PointerType::get(scalarType, pLoad->getPointerAddressSpace()); | ||
1959 | IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize); | ||
1960 | Value* vec = UndefValue::get(pLoad->getType()); | ||
1961 | - auto pLoadVT = cast<VectorType>(pLoad->getType()); | ||
1962 | + auto pLoadVT = cast<IGCLLVM::FixedVectorType>(pLoad->getType()); | ||
1963 | for (unsigned i = 0, e = (unsigned)pLoadVT->getNumElements(); i < e; ++i) | ||
1964 | { | ||
1965 | Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy); | ||
1966 | @@ -657,7 +657,7 @@ public: | ||
1967 | IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize); | ||
1968 | Value* vec = pStore->getValueOperand(); | ||
1969 | |||
1970 | - unsigned vecNumElts = (unsigned)cast<VectorType>(vec->getType())->getNumElements(); | ||
1971 | + unsigned vecNumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements(); | ||
1972 | for (unsigned i = 0; i < vecNumElts; ++i) | ||
1973 | { | ||
1974 | Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy); | ||
1975 | @@ -728,7 +728,7 @@ bool PrivateMemoryResolution::testTransposedMemory(const Type* pTmpType, const T | ||
1976 | } | ||
1977 | else if(pTmpType->isVectorTy()) | ||
1978 | { | ||
1979 | - auto pTmpVType = cast<VectorType>(pTmpType); | ||
1980 | + auto pTmpVType = cast<IGCLLVM::FixedVectorType>(pTmpType); | ||
1981 | tmpAllocaSize *= pTmpVType->getNumElements(); | ||
1982 | pTmpType = pTmpType->getContainedType(0); | ||
1983 | ok = (nullptr != pTmpType); | ||
1984 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp | ||
1985 | index 88707c588..ae9c7e671 100644 | ||
1986 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp | ||
1987 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp | ||
1988 | @@ -244,7 +244,7 @@ Instruction* ReplaceUnsupportedIntrinsics::insertLoop(Instruction* Loc, Value* L | ||
1989 | Value* ReplaceUnsupportedIntrinsics::replicateScalar( | ||
1990 | Value* ScalarVal, Type* Ty, Instruction* InsertBefore) | ||
1991 | { | ||
1992 | - VectorType* VTy = dyn_cast<VectorType>(Ty); | ||
1993 | + IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
1994 | Type* ETy = VTy ? VTy->getElementType() : Ty; | ||
1995 | uint32_t sBits = (unsigned int)ScalarVal->getType()->getPrimitiveSizeInBits(); | ||
1996 | uint32_t nBits = (unsigned int)ETy->getPrimitiveSizeInBits(); | ||
1997 | @@ -905,7 +905,7 @@ void ReplaceUnsupportedIntrinsics::replaceFunnelShift(IntrinsicInst* I) { | ||
1998 | } | ||
1999 | |||
2000 | Value* numBits = Builder.getIntN(sizeInBits, sizeInBits); | ||
2001 | - if (auto IVT = dyn_cast<VectorType>(I->getType())) { | ||
2002 | + if (auto IVT = dyn_cast<IGCLLVM::FixedVectorType>(I->getType())) { | ||
2003 | numBits = ConstantVector::getSplat(IGCLLVM::getElementCount((uint32_t)IVT->getNumElements()), cast<Constant>(numBits)); | ||
2004 | } | ||
2005 | auto shiftModulo = Builder.CreateURem(I->getArgOperand(2), numBits); | ||
2006 | diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp | ||
2007 | index a8e24680c..4de05effa 100644 | ||
2008 | --- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp | ||
2009 | +++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp | ||
2010 | @@ -279,7 +279,7 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType) | ||
2011 | auto Size = ElemByteSize; | ||
2012 | if (auto DataVecType = dyn_cast<VectorType>(DataType)) | ||
2013 | { | ||
2014 | - Size *= (unsigned int)DataVecType->getNumElements(); | ||
2015 | + Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements(); | ||
2016 | } | ||
2017 | unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize; | ||
2018 | unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2; | ||
2019 | diff --git a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp | ||
2020 | index 248ab1039..423beef7b 100644 | ||
2021 | --- a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp | ||
2022 | +++ b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp | ||
2023 | @@ -339,7 +339,7 @@ bool PreCompiledFuncImport::preProcessDouble() | ||
2024 | } | ||
2025 | else | ||
2026 | { | ||
2027 | - uint32_t vectorSize = cast<VectorType>(Inst->getType())->getNumElements(); | ||
2028 | + uint32_t vectorSize = cast<IGCLLVM::FixedVectorType>(Inst->getType())->getNumElements(); | ||
2029 | fsub = llvm::UndefValue::get(Inst->getType()); | ||
2030 | |||
2031 | for (uint32_t i = 0; i < vectorSize; ++i) | ||
2032 | @@ -1002,7 +1002,7 @@ void PreCompiledFuncImport::processDivide(BinaryOperator& inst, EmulatedFunction | ||
2033 | |||
2034 | Type* argumentType = inst.getOperand(0)->getType(); | ||
2035 | |||
2036 | - if (auto argumentVType = dyn_cast<VectorType>(argumentType)) | ||
2037 | + if (auto argumentVType = dyn_cast<IGCLLVM::FixedVectorType>(argumentType)) | ||
2038 | { | ||
2039 | numElements = (unsigned)argumentVType->getNumElements(); | ||
2040 | } | ||
2041 | diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp | ||
2042 | index 740fb4d57..b98ba6693 100644 | ||
2043 | --- a/IGC/Compiler/Optimizer/Scalarizer.cpp | ||
2044 | +++ b/IGC/Compiler/Optimizer/Scalarizer.cpp | ||
2045 | @@ -403,7 +403,7 @@ void ScalarizeFunction::scalarizeInstruction(BinaryOperator* BI) | ||
2046 | { | ||
2047 | V_PRINT(scalarizer, "\t\tBinary instruction\n"); | ||
2048 | IGC_ASSERT_MESSAGE(BI, "instruction type dynamic cast failed"); | ||
2049 | - VectorType* instType = dyn_cast<VectorType>(BI->getType()); | ||
2050 | + IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(BI->getType()); | ||
2051 | // Only need handling for vector binary ops | ||
2052 | if (!instType) return; | ||
2053 | |||
2054 | @@ -463,7 +463,7 @@ void ScalarizeFunction::scalarizeInstruction(CmpInst* CI) | ||
2055 | { | ||
2056 | V_PRINT(scalarizer, "\t\tCompare instruction\n"); | ||
2057 | IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed"); | ||
2058 | - VectorType* instType = dyn_cast<VectorType>(CI->getType()); | ||
2059 | + IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getType()); | ||
2060 | // Only need handling for vector compares | ||
2061 | if (!instType) return; | ||
2062 | |||
2063 | @@ -511,13 +511,13 @@ void ScalarizeFunction::scalarizeInstruction(CastInst* CI) | ||
2064 | { | ||
2065 | V_PRINT(scalarizer, "\t\tCast instruction\n"); | ||
2066 | IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed"); | ||
2067 | - VectorType* instType = dyn_cast<VectorType>(CI->getType()); | ||
2068 | + IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getType()); | ||
2069 | |||
2070 | // For BitCast - we only scalarize if src and dst types have same vector length | ||
2071 | if (isa<BitCastInst>(CI)) | ||
2072 | { | ||
2073 | if (!instType) return recoverNonScalarizableInst(CI); | ||
2074 | - VectorType* srcType = dyn_cast<VectorType>(CI->getOperand(0)->getType()); | ||
2075 | + IGCLLVM::FixedVectorType* srcType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getOperand(0)->getType()); | ||
2076 | if (!srcType || (instType->getNumElements() != srcType->getNumElements())) | ||
2077 | { | ||
2078 | return recoverNonScalarizableInst(CI); | ||
2079 | @@ -572,7 +572,7 @@ void ScalarizeFunction::scalarizeInstruction(PHINode* PI) | ||
2080 | { | ||
2081 | V_PRINT(scalarizer, "\t\tPHI instruction\n"); | ||
2082 | IGC_ASSERT_MESSAGE(PI, "instruction type dynamic cast failed"); | ||
2083 | - VectorType* instType = dyn_cast<VectorType>(PI->getType()); | ||
2084 | + IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(PI->getType()); | ||
2085 | // Only need handling for vector PHI | ||
2086 | if (!instType) return; | ||
2087 | |||
2088 | @@ -683,7 +683,7 @@ void ScalarizeFunction::scalarizeInstruction(SelectInst* SI) | ||
2089 | { | ||
2090 | V_PRINT(scalarizer, "\t\tSelect instruction\n"); | ||
2091 | IGC_ASSERT_MESSAGE(SI, "instruction type dynamic cast failed"); | ||
2092 | - VectorType* instType = dyn_cast<VectorType>(SI->getType()); | ||
2093 | + IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(SI->getType()); | ||
2094 | // Only need handling for vector select | ||
2095 | if (!instType) return; | ||
2096 | |||
2097 | @@ -765,7 +765,7 @@ void ScalarizeFunction::scalarizeInstruction(ExtractElementInst* EI) | ||
2098 | |||
2099 | // Connect the "extracted" value to all its consumers | ||
2100 | uint64_t scalarIndex = cast<ConstantInt>(scalarIndexVal)->getZExtValue(); | ||
2101 | - auto valueVType = cast<VectorType>(vectorValue->getType()); | ||
2102 | + auto valueVType = cast<IGCLLVM::FixedVectorType>(vectorValue->getType()); | ||
2103 | if (static_cast<unsigned int>(scalarIndex) < (unsigned)valueVType->getNumElements()) | ||
2104 | { | ||
2105 | IGC_ASSERT_MESSAGE(NULL != operand[static_cast<unsigned int>(scalarIndex)], "SCM error"); | ||
2106 | @@ -829,7 +829,7 @@ void ScalarizeFunction::scalarizeInstruction(InsertElementInst* II) | ||
2107 | if (isa<UndefValue>(sourceVectorValue)) | ||
2108 | { | ||
2109 | // Scalarize the undef value (generate a scalar undef) | ||
2110 | - VectorType* inputVectorType = dyn_cast<VectorType>(sourceVectorValue->getType()); | ||
2111 | + IGCLLVM::FixedVectorType* inputVectorType = dyn_cast<IGCLLVM::FixedVectorType>(sourceVectorValue->getType()); | ||
2112 | IGC_ASSERT_MESSAGE(inputVectorType, "expected vector argument"); | ||
2113 | |||
2114 | UndefValue* undefVal = UndefValue::get(inputVectorType->getElementType()); | ||
2115 | @@ -870,7 +870,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI) | ||
2116 | IGC_ASSERT(nullptr != sourceVector0Value); | ||
2117 | Value* sourceVector1Value = SI->getOperand(1); | ||
2118 | IGC_ASSERT(nullptr != sourceVector1Value); | ||
2119 | - VectorType* const inputType = dyn_cast<VectorType>(sourceVector0Value->getType()); | ||
2120 | + IGCLLVM::FixedVectorType* const inputType = dyn_cast<IGCLLVM::FixedVectorType>(sourceVector0Value->getType()); | ||
2121 | IGC_ASSERT_MESSAGE(nullptr != inputType, "vector input error"); | ||
2122 | IGC_ASSERT_MESSAGE(inputType == sourceVector1Value->getType(), "vector input error"); | ||
2123 | unsigned sourceVectorWidth = int_cast<unsigned>(inputType->getNumElements()); | ||
2124 | @@ -892,7 +892,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI) | ||
2125 | |||
2126 | // Generate array for shuffled scalar values | ||
2127 | SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector; | ||
2128 | - unsigned width = int_cast<unsigned>(SI->getType()->getNumElements()); | ||
2129 | + unsigned width = int_cast<unsigned>(cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements()); | ||
2130 | |||
2131 | // Generate undef value, which may be needed as some scalar elements | ||
2132 | UndefValue* undef = UndefValue::get(inputType->getElementType()); | ||
2133 | @@ -961,7 +961,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI) | ||
2134 | |||
2135 | if (baseValue->getType()->isVectorTy()) | ||
2136 | { | ||
2137 | - width = int_cast<unsigned>(dyn_cast<VectorType>(baseValue->getType())->getNumElements()); | ||
2138 | + width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(baseValue->getType())->getNumElements()); | ||
2139 | // Obtain the scalarized operands | ||
2140 | obtainScalarizedValues(operand1, NULL, baseValue, GI); | ||
2141 | ptrTy = dyn_cast<VectorType>(baseValue->getType())->getElementType(); | ||
2142 | @@ -972,7 +972,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI) | ||
2143 | } | ||
2144 | if (indexValue->getType()->isVectorTy()) | ||
2145 | { | ||
2146 | - width = int_cast<unsigned>(dyn_cast<VectorType>(indexValue->getType())->getNumElements()); | ||
2147 | + width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(indexValue->getType())->getNumElements()); | ||
2148 | // Obtain the scalarized operands | ||
2149 | obtainScalarizedValues(operand2, NULL, indexValue, GI); | ||
2150 | } | ||
2151 | @@ -1011,7 +1011,7 @@ void ScalarizeFunction::obtainScalarizedValues(SmallVectorImpl<Value*>& retValue | ||
2152 | { | ||
2153 | V_PRINT(scalarizer, "\t\t\tObtaining scalar value... " << *origValue << "\n"); | ||
2154 | |||
2155 | - VectorType* origType = dyn_cast<VectorType>(origValue->getType()); | ||
2156 | + IGCLLVM::FixedVectorType* origType = dyn_cast<IGCLLVM::FixedVectorType>(origValue->getType()); | ||
2157 | IGC_ASSERT_MESSAGE(origType, "Value must have a vector type!"); | ||
2158 | unsigned width = int_cast<unsigned>(origType->getNumElements()); | ||
2159 | |||
2160 | @@ -1170,7 +1170,7 @@ void ScalarizeFunction::obtainVectorValueWhichMightBeScalarizedImpl(Value* vecto | ||
2161 | } | ||
2162 | |||
2163 | Value* assembledVector = UndefValue::get(vectorVal->getType()); | ||
2164 | - unsigned width = int_cast<unsigned>(dyn_cast<VectorType>(vectorVal->getType())->getNumElements()); | ||
2165 | + unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(vectorVal->getType())->getNumElements()); | ||
2166 | for (unsigned i = 0; i < width; i++) | ||
2167 | { | ||
2168 | IGC_ASSERT_MESSAGE(NULL != valueEntry->scalarValues[i], "SCM entry has NULL value"); | ||
2169 | @@ -1230,7 +1230,7 @@ void ScalarizeFunction::updateSCMEntryWithValues(ScalarizeFunction::SCMEntry* en | ||
2170 | bool matchDbgLoc) | ||
2171 | { | ||
2172 | IGC_ASSERT_MESSAGE((origValue->getType()->isArrayTy() || origValue->getType()->isVectorTy()), "only Vector values are supported"); | ||
2173 | - unsigned width = int_cast<unsigned>(dyn_cast<VectorType>(origValue->getType())->getNumElements()); | ||
2174 | + unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(origValue->getType())->getNumElements()); | ||
2175 | |||
2176 | entry->isOriginalVectorRemoved = isOrigValueRemoved; | ||
2177 | |||
2178 | @@ -1301,7 +1301,7 @@ void ScalarizeFunction::resolveDeferredInstructions() | ||
2179 | Instruction* vectorInst = dyn_cast<Instruction>(current.unresolvedInst); | ||
2180 | IGC_ASSERT_MESSAGE(vectorInst, "DRL only handles unresolved instructions"); | ||
2181 | |||
2182 | - VectorType* currType = dyn_cast<VectorType>(vectorInst->getType()); | ||
2183 | + IGCLLVM::FixedVectorType* currType = dyn_cast<IGCLLVM::FixedVectorType>(vectorInst->getType()); | ||
2184 | IGC_ASSERT_MESSAGE(currType, "Cannot have DRL of non-vector value"); | ||
2185 | unsigned width = int_cast<unsigned>(currType->getNumElements()); | ||
2186 | |||
2187 | diff --git a/IGC/Compiler/Optimizer/ValueTracker.cpp b/IGC/Compiler/Optimizer/ValueTracker.cpp | ||
2188 | index a2796daa5..a3d03d267 100644 | ||
2189 | --- a/IGC/Compiler/Optimizer/ValueTracker.cpp | ||
2190 | +++ b/IGC/Compiler/Optimizer/ValueTracker.cpp | ||
2191 | @@ -162,7 +162,7 @@ Value* ValueTracker::handleExtractElement(ExtractElementInst* E) | ||
2192 | { | ||
2193 | auto mask = I->getShuffleMask(); | ||
2194 | uint shuffleidx = int_cast<uint>(mask[(uint)idx]); | ||
2195 | - auto vType = dyn_cast<VectorType>(I->getOperand(0)->getType()); | ||
2196 | + auto vType = dyn_cast<IGCLLVM::FixedVectorType>(I->getOperand(0)->getType()); | ||
2197 | baseValue = (shuffleidx < vType->getNumElements()) ? | ||
2198 | I->getOperand(0) : I->getOperand(1); | ||
2199 | } | ||
2200 | diff --git a/IGC/Compiler/VerificationPass.cpp b/IGC/Compiler/VerificationPass.cpp | ||
2201 | index 7a9d69bec..df73419c0 100644 | ||
2202 | --- a/IGC/Compiler/VerificationPass.cpp | ||
2203 | +++ b/IGC/Compiler/VerificationPass.cpp | ||
2204 | @@ -286,7 +286,7 @@ bool VerificationPass::verifyType(Type* type, Value* val) | ||
2205 | |||
2206 | case IGCLLVM::VectorTyID: | ||
2207 | { | ||
2208 | - auto VType = cast<VectorType>(type); | ||
2209 | + auto VType = cast<IGCLLVM::FixedVectorType>(type); | ||
2210 | unsigned typeSize = (unsigned)VType->getNumElements(); | ||
2211 | if (!m_IGC_IR_spec.vectorTypeSizes.count(typeSize)) | ||
2212 | { | ||
2213 | diff --git a/IGC/DebugInfo/DebugInfoUtils.hpp b/IGC/DebugInfo/DebugInfoUtils.hpp | ||
2214 | index 28b7fcf73..d16d79a3d 100644 | ||
2215 | --- a/IGC/DebugInfo/DebugInfoUtils.hpp | ||
2216 | +++ b/IGC/DebugInfo/DebugInfoUtils.hpp | ||
2217 | @@ -92,7 +92,7 @@ namespace IGC | ||
2218 | IGCLLVM::DIBuilder Builder(M); | ||
2219 | llvm::DIGlobalVariable* GV = GVs[j]->getVariable(); | ||
2220 | llvm::DIScope* scopeToUse = GV->getScope(); | ||
2221 | - llvm::DILocation* locToUse = llvm::DebugLoc::get(GV->getLine(), 0, scopeToUse, loc); | ||
2222 | + llvm::DILocation* locToUse = llvm::DILocation::get(scopeToUse->getContext(), GV->getLine(), 0, scopeToUse, loc); | ||
2223 | if (llvm::isa<llvm::DICompileUnit>(GV->getScope())) | ||
2224 | { | ||
2225 | // Function has no DebugLoc so it is either internal | ||
2226 | diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp | ||
2227 | index 027a3a530..f57dd72cb 100644 | ||
2228 | --- a/IGC/DebugInfo/DwarfDebug.cpp | ||
2229 | +++ b/IGC/DebugInfo/DwarfDebug.cpp | ||
2230 | @@ -1993,9 +1993,9 @@ static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext& Ctx) | ||
2231 | // Check for number of operands since the compatibility is cheap here. | ||
2232 | if (SP->getNumOperands() > 19) | ||
2233 | { | ||
2234 | - return DebugLoc::get(SP->getScopeLine(), 0, SP); | ||
2235 | + return DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP); | ||
2236 | } | ||
2237 | - return DebugLoc::get(SP->getLine(), 0, SP); | ||
2238 | + return DILocation::get(SP->getContext(), SP->getLine(), 0, SP); | ||
2239 | } | ||
2240 | |||
2241 | return DebugLoc(); | ||
2242 | diff --git a/IGC/GenISAIntrinsics/GenIntrinsics.cpp b/IGC/GenISAIntrinsics/GenIntrinsics.cpp | ||
2243 | index a6d6f0ae6..c48271125 100644 | ||
2244 | --- a/IGC/GenISAIntrinsics/GenIntrinsics.cpp | ||
2245 | +++ b/IGC/GenISAIntrinsics/GenIntrinsics.cpp | ||
2246 | @@ -188,7 +188,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos, | ||
2247 | case IITDescriptor::SameVecWidthArgument: { | ||
2248 | Type *EltTy = DecodeFixedType(Infos, Tys, Context); | ||
2249 | Type *Ty = Tys[D.getArgumentNumber()]; | ||
2250 | - if (VectorType *VTy = dyn_cast<VectorType>(Ty)) { | ||
2251 | + if (IGCLLVM::FixedVectorType *VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty)) { | ||
2252 | return IGCLLVM::FixedVectorType::get(EltTy, int_cast<unsigned int>(VTy->getNumElements())); | ||
2253 | } | ||
2254 | IGC_ASSERT_EXIT_MESSAGE(0, "unhandled"); | ||
2255 | @@ -199,7 +199,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos, | ||
2256 | } | ||
2257 | case IITDescriptor::VecOfPtrsToElt: { | ||
2258 | Type *Ty = Tys[D.getArgumentNumber()]; | ||
2259 | - VectorType *VTy = dyn_cast<VectorType>(Ty); | ||
2260 | + IGCLLVM::FixedVectorType *VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); | ||
2261 | if (!VTy) | ||
2262 | IGC_ASSERT_EXIT_MESSAGE(0, "Expected an argument of Vector Type"); | ||
2263 | Type *EltTy = cast<VectorType>(VTy)->getElementType(); | ||
2264 | @@ -418,7 +418,7 @@ static std::string getMangledTypeStr(Type* Ty) { | ||
2265 | Result += "f"; | ||
2266 | } | ||
2267 | else if (isa<VectorType>(Ty)) | ||
2268 | - Result += "v" + utostr(cast<VectorType>(Ty)->getNumElements()) + | ||
2269 | + Result += "v" + utostr(cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements()) + | ||
2270 | getMangledTypeStr(cast<VectorType>(Ty)->getElementType()); | ||
2271 | else if (Ty) | ||
2272 | Result += EVT::getEVT(Ty).getEVTString(); | ||
2273 | diff --git a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp | ||
2274 | index 2306c2357..b5f66f048 100644 | ||
2275 | --- a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp | ||
2276 | +++ b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp | ||
2277 | @@ -4993,7 +4993,7 @@ void LLVM3DBuilder<preserveNames, T, Inserter>::VectorToScalars( | ||
2278 | IGC_ASSERT(nullptr != vector->getType()); | ||
2279 | IGC_ASSERT(vector->getType()->isVectorTy()); | ||
2280 | |||
2281 | - const unsigned count = (unsigned)llvm::cast<llvm::VectorType>(vector->getType())->getNumElements(); | ||
2282 | + const unsigned count = (unsigned)llvm::cast<IGCLLVM::FixedVectorType>(vector->getType())->getNumElements(); | ||
2283 | IGC_ASSERT(1 < count); | ||
2284 | IGC_ASSERT(count <= 4); | ||
2285 | IGC_ASSERT(count <= maxSize); | ||
2286 | diff --git a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h | ||
2287 | index a207f5d44..117dae814 100644 | ||
2288 | --- a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h | ||
2289 | +++ b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h | ||
2290 | @@ -11,6 +11,7 @@ SPDX-License-Identifier: MIT | ||
2291 | |||
2292 | #include "llvm/Config/llvm-config.h" | ||
2293 | #include "llvm/IR/DerivedTypes.h" | ||
2294 | +#include "llvm/IR/Module.h" | ||
2295 | |||
2296 | namespace IGCLLVM | ||
2297 | { | ||
2298 | @@ -44,6 +45,15 @@ namespace IGCLLVM | ||
2299 | return false; | ||
2300 | #endif | ||
2301 | } | ||
2302 | + | ||
2303 | + inline llvm::StructType *getTypeByName(llvm::Module *M, llvm::StringRef Name) { | ||
2304 | +#if LLVM_VERSION_MAJOR >= 12 | ||
2305 | + return llvm::StructType::getTypeByName(M->getContext(), Name); | ||
2306 | +#else | ||
2307 | + return M->getTypeByName(Name); | ||
2308 | +#endif | ||
2309 | + } | ||
2310 | + | ||
2311 | } | ||
2312 | |||
2313 | #endif | ||
2314 | diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h | ||
2315 | index 19c5183eb..709f1bbbb 100644 | ||
2316 | --- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h | ||
2317 | +++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h | ||
2318 | @@ -17,10 +17,14 @@ using namespace llvm; | ||
2319 | namespace IGCLLVM { | ||
2320 | #if LLVM_VERSION_MAJOR < 11 | ||
2321 | inline unsigned getElementCount(unsigned EC) { return EC; } | ||
2322 | -#else | ||
2323 | +#elif LLVM_VERSION_MAJOR == 11 | ||
2324 | inline ElementCount getElementCount(unsigned EC) { | ||
2325 | return ElementCount(EC, false); | ||
2326 | } | ||
2327 | +#else | ||
2328 | +inline ElementCount getElementCount(unsigned EC) { | ||
2329 | + return ElementCount::get(EC, false); | ||
2330 | +} | ||
2331 | #endif | ||
2332 | } // namespace IGCLLVM | ||
2333 | |||
2334 | diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h | ||
2335 | index 74841ddc1..1df041372 100644 | ||
2336 | --- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h | ||
2337 | +++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h | ||
2338 | @@ -26,7 +26,7 @@ namespace IGCLLVM | ||
2339 | { | ||
2340 | return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling); | ||
2341 | } | ||
2342 | -#elif LLVM_VERSION_MAJOR == 9 || LLVM_VERSION_MAJOR == 10 || LLVM_VERSION_MAJOR == 11 | ||
2343 | +#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 12 | ||
2344 | inline static llvm::Pass * createLoopUnrollPass( | ||
2345 | int OptLevel = 2, int Threshold = -1, int Count = -1, | ||
2346 | int AllowPartial = -1, int Runtime = -1, | ||
2347 | @@ -34,7 +34,7 @@ namespace IGCLLVM | ||
2348 | { | ||
2349 | return llvm::createLoopUnrollPass(OptLevel, false, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling); | ||
2350 | } | ||
2351 | -#elif LLVM_VERSION_MAJOR >= 12 | ||
2352 | +#else | ||
2353 | //DO NOT assume same function signature for all incoming llvm versions! Double check to upgrade! | ||
2354 | #error Not supported llvm version. | ||
2355 | #endif | ||
2356 | diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h | ||
2357 | index 8cf0adf24..33d5b7c35 100644 | ||
2358 | --- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h | ||
2359 | +++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h | ||
2360 | @@ -23,6 +23,14 @@ namespace IGCLLVM | ||
2361 | return llvm::InsertPreheaderForLoop(L, DT, LI, nullptr, PreserveLCSSA); | ||
2362 | } | ||
2363 | #endif | ||
2364 | + | ||
2365 | + inline bool isInnermost(llvm::Loop *L) { | ||
2366 | +#if LLVM_VERSION_MAJOR >= 12 | ||
2367 | + return L->isInnermost(); | ||
2368 | +#else | ||
2369 | + return L->empty(); | ||
2370 | +#endif | ||
2371 | + } | ||
2372 | } | ||
2373 | |||
2374 | #endif | ||
2375 | diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h | ||
2376 | index a9a6a1871..713d6f4bb 100644 | ||
2377 | --- a/IGC/common/igc_resourceDimTypes.h | ||
2378 | +++ b/IGC/common/igc_resourceDimTypes.h | ||
2379 | @@ -50,6 +50,10 @@ namespace IGC | ||
2380 | resourceDimTypeId == DIM_2D_TYPE || resourceDimTypeId == DIM_2D_ARRAY_TYPE || | ||
2381 | resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE)); | ||
2382 | |||
2383 | +#if LLVM_VERSION_MAJOR >= 12 | ||
2384 | + return llvm::StructType::getTypeByName(module.getContext(), ResourceDimensionTypeName[resourceDimTypeId]); | ||
2385 | +#else | ||
2386 | return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]); | ||
2387 | +#endif | ||
2388 | } | ||
2389 | -} | ||
2390 | \ No newline at end of file | ||
2391 | +} | ||
2392 | -- | ||
2393 | 2.20.1 | ||
2394 | |||
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.8365.bb b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.8744.bb index 8d557b07..1469bc14 100644 --- a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.8365.bb +++ b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.8744.bb | |||
@@ -8,16 +8,15 @@ LIC_FILES_CHKSUM = "file://IGC/BiFModule/Implementation/ExternalLibraries/libclc | |||
8 | file://IGC/Compiler/LegalizationPass.cpp;beginline=1;endline=23;md5=4a985f2545dd5a846e205b1e60a51cd9 \ | 8 | file://IGC/Compiler/LegalizationPass.cpp;beginline=1;endline=23;md5=4a985f2545dd5a846e205b1e60a51cd9 \ |
9 | file://NOTICES.txt;md5=db621145dfb627436bc90ad600386801" | 9 | file://NOTICES.txt;md5=db621145dfb627436bc90ad600386801" |
10 | 10 | ||
11 | SRC_URI = "git://github.com/intel/intel-graphics-compiler.git;protocol=https; \ | 11 | SRC_URI = "git://github.com/intel/intel-graphics-compiler.git;protocol=https;name=igc \ |
12 | file://0001-skip-execution-of-ElfPackager.patch \ | 12 | git://github.com/intel/vc-intrinsics.git;protocol=https;destsuffix=git/vc-intrinsics;name=vc \ |
13 | file://0002-IGC-VectorCompiler-CMakeLists.txt-link-to-external-L.patch \ | 13 | file://0001-llvm_deps.cmake-don-t-copy-header-file-when-building.patch \ |
14 | file://0003-Improve-Reproducibility-for-src-package.patch \ | 14 | file://0003-Improve-Reproducibility-for-src-package.patch \ |
15 | file://0004-find-external-llvm-tblgen.patch \ | 15 | file://0004-find-external-llvm-tblgen.patch \ |
16 | file://0005-Temporary-LLVM-12-compatiblity-fix.patch \ | 16 | " |
17 | file://0001-LLVM-13-fixes.patch \ | ||
18 | " | ||
19 | 17 | ||
20 | SRCREV = "5d5672d6cc0c415dae76648390026f777004bd99" | 18 | SRCREV_igc = "3ba8dde8c414a0e47df58b1bba12a64f8ba2089e" |
19 | SRCREV_vc = "e5ad7e02aa4aa21a3cd7b3e5d1f3ec9b95f58872" | ||
21 | 20 | ||
22 | # Used to replace with relative path in reproducibility patch | 21 | # Used to replace with relative path in reproducibility patch |
23 | export B | 22 | export B |
@@ -26,17 +25,28 @@ S = "${WORKDIR}/git" | |||
26 | 25 | ||
27 | inherit cmake | 26 | inherit cmake |
28 | 27 | ||
29 | CXXFLAGS:append = " -Wno-error=deprecated-declarations" | 28 | CXXFLAGS:append = " -Wno-error=nonnull" |
30 | 29 | ||
31 | COMPATIBLE_HOST = '(x86_64).*-linux' | 30 | COMPATIBLE_HOST = '(x86_64).*-linux' |
32 | COMPATIBLE_HOST:libc-musl = "null" | 31 | COMPATIBLE_HOST:libc-musl = "null" |
33 | 32 | ||
34 | DEPENDS += " flex-native bison-native clang opencl-clang vc-intrinsics" | 33 | DEPENDS += " flex-native bison-native clang opencl-clang" |
35 | DEPENDS:append:class-target = " clang-cross-x86_64" | 34 | DEPENDS:append:class-target = " clang-cross-x86_64 intel-graphics-compiler-native" |
36 | 35 | ||
37 | RDEPENDS:${PN} += "opencl-clang" | 36 | RDEPENDS:${PN} += "opencl-clang" |
38 | 37 | ||
39 | EXTRA_OECMAKE = "-DIGC_OPTION__LLVM_PREFERRED_VERSION=${LLVMVERSION} -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 -DIGC_BUILD__VC_ENABLED=OFF -DIGC_BUILD__USE_KHRONOS_SPIRV_TRANSLATOR=ON" | 38 | EXTRA_OECMAKE = " \ |
39 | -DIGC_OPTION__LLVM_PREFERRED_VERSION=${LLVMVERSION} \ | ||
40 | -DPYTHON_EXECUTABLE=${HOSTTOOLS_DIR}/python3 \ | ||
41 | -DVC_INTRINSICS_SRC="${S}/vc-intrinsics" \ | ||
42 | -DIGC_OPTION__LLVM_MODE=Prebuilds \ | ||
43 | -DIGC_BUILD__VC_ENABLED=OFF \ | ||
44 | " | ||
45 | |||
46 | do_install:append:class-native () { | ||
47 | install -d ${D}${bindir} | ||
48 | install ${B}/IGC/Release/elf_packager ${D}${bindir}/ | ||
49 | } | ||
40 | 50 | ||
41 | BBCLASSEXTEND = "native nativesdk" | 51 | BBCLASSEXTEND = "native nativesdk" |
42 | 52 | ||