summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch
blob: b102af0f9447fed1f23f6779ba2f704f320ebd9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
From 6247039d9193adf3813375fefc95071e8f5b4097 Mon Sep 17 00:00:00 2001
From: Buildbot <buildbot@xenial.com>
Date: Fri, 27 Aug 2021 07:07:04 +0000
Subject: [PATCH] LLVM 13 fixes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Upstream-Status: Submitted
---
 .../LegalizeFunctionSignatures.cpp            |  4 ++++
 IGC/AdaptorOCL/OCL/sp/spp_g8.cpp              |  6 ++++-
 IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp          |  8 +++++++
 IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp            |  8 +++++++
 IGC/Compiler/GenTTI.cpp                       |  4 ++++
 IGC/Compiler/GenTTI.h                         |  4 ++++
 IGC/Compiler/Optimizer/BuiltInFuncImport.cpp  |  4 ++++
 IGC/Compiler/Optimizer/CodeAssumption.cpp     |  5 ++++
 .../AddressSpaceAliasAnalysis.cpp             | 23 +++++++++++++++++++
 .../PrivateMemory/PrivateMemoryResolution.cpp |  3 +++
 IGC/DebugInfo/DwarfDebug.cpp                  |  8 +++++++
 IGC/DebugInfo/StreamEmitter.cpp               | 14 ++++++++++-
 IGC/ElfPackager/main.cpp                      |  4 ++++
 .../BuiltinsFrontendDefinitions.hpp           |  2 +-
 .../lib/GenXCodeGen/GenXTargetMachine.h       |  4 ++++
 .../include/llvmWrapper/Transforms/Scalar.h   |  2 +-
 IGC/common/LLVMUtils.cpp                      | 12 ++++++++++
 visa/iga/IGALibrary/IR/BitSet.hpp             |  2 ++
 18 files changed, 113 insertions(+), 4 deletions(-)

diff --git a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
index ee43be301..395f26c91 100644
--- a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
+++ b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
@@ -377,7 +377,11 @@ void LegalizeFunctionSignatures::FixFunctionBody(Module& M)
             }
 
             // Clone the old function body into the new
+#if LLVM_VERSION_MAJOR >= 13
+            CloneFunctionInto(pNewFunc, pFunc, VMap, CloneFunctionChangeType::DifferentModule, Returns);
+#else
             CloneFunctionInto(pNewFunc, pFunc, VMap, true, Returns);
+#endif
 
             // Merge the BB for when extra instructions were created
             BasicBlock* ClonedEntryBB = cast<BasicBlock>(VMap[&*pFunc->begin()]);
diff --git a/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp b/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp
index 6f7c711bc..8d8c4e50d 100644
--- a/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp
+++ b/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp
@@ -387,7 +387,11 @@ bool createElfFileName(std::string &name, unsigned int maxNameLen, SIMDMode simd
         unsigned int mode = sys::fs::perms::all_read | sys::fs::perms::all_write;
         // Every '%' will be replaced with a random character (0-9 or a-f), taking care of multithreaded compilations
         if (std::error_code EC = sys::fs::createUniqueFile(
-            uniqueLockFileName, uniqueLockFileID, resultUniqueLockFileName, mode))
+            uniqueLockFileName, uniqueLockFileID, resultUniqueLockFileName,
+#if LLVM_VERSION_MAJOR >= 13
+            llvm::sys::fs::OF_None,
+#endif
+            mode))
         {
             IGC_ASSERT_MESSAGE(false, "A uniquely named file not created");
             retValue = false;
diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
index 65e672afe..f28136a6a 100644
--- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
@@ -97,7 +97,11 @@ isOpenCLKernel(SPIRVFunction *BF) {
 __attr_unused static void
 dumpLLVM(Module *M, const std::string &FName) {
   std::error_code EC;
+#if LLVM_VERSION_MAJOR >= 13
+  raw_fd_ostream FS(FName, EC, sys::fs::OF_None);
+#else
   raw_fd_ostream FS(FName, EC, sys::fs::F_None);
+#endif
   if (!FS.has_error()) {
     FS << *M;
   }
@@ -2413,7 +2417,11 @@ SPIRVToLLVM::postProcessFunctionsReturnStruct(Function *F) {
           NewArgIt->setName(OldArgIt->getName());
           VMap[&*OldArgIt] = &*NewArgIt;
       }
+#if LLVM_VERSION_MAJOR >= 13
+      CloneFunctionInto(NewF, F, VMap, CloneFunctionChangeType::DifferentModule, Returns);
+#else
       CloneFunctionInto(NewF, F, VMap, true, Returns);
+#endif
       auto DL = M->getDataLayout();
       const auto ptrSize = DL.getPointerSize();
 
diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
index ecb045b88..0a0893e4a 100644
--- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
@@ -67,7 +67,11 @@ namespace igc_spv{
 void
 saveLLVMModule(Module *M, const std::string &OutputFile) {
   std::error_code EC;
+#if LLVM_VERSION_MAJOR >= 13
+  llvm::ToolOutputFile Out(OutputFile.c_str(), EC, sys::fs::OF_None);
+#else
   llvm::ToolOutputFile Out(OutputFile.c_str(), EC, sys::fs::F_None);
+#endif
   IGC_ASSERT_EXIT_MESSAGE((!EC), "Failed to open file");
   IGCLLVM::WriteBitcodeToFile(M, Out.os());
   Out.keep();
@@ -326,7 +330,11 @@ mutateCallInst(Module *M, CallInst *CI,
       }
     }
 
+#if LLVM_VERSION_MAJOR >= 13
+    CloneFunctionInto(NewF, OldF, VMap, CloneFunctionChangeType::DifferentModule, Returns);
+#else
     CloneFunctionInto(NewF, OldF, VMap, true, Returns);
+#endif
 
     // Merge the basic block with Load instruction with the original entry basic block.
     BasicBlock* ClonedEntryBB = cast<BasicBlock>(VMap[&*OldF->begin()]);
diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp
index 8a74ec287..23c9bc6ed 100644
--- a/IGC/Compiler/GenTTI.cpp
+++ b/IGC/Compiler/GenTTI.cpp
@@ -461,7 +461,11 @@ namespace llvm {
   // [LLVM-UPGRADE] moved from getCallCost to getUserCost
   // https://github.com/llvm/llvm-project/commit/2641a19981e71c887bece92074e00d1af3e716c9#diff-dd4bd65dc55d754674d9a945a0d22911
 
+#if LLVM_VERSION_MAJOR >= 13
+  InstructionCost GenIntrinsicsTTIImpl::getUserCost(const User *U, ArrayRef<const Value *> Operands, TTI::TargetCostKind CostKind)
+#else
   int GenIntrinsicsTTIImpl::getUserCost(const User *U, ArrayRef<const Value *> Operands, TTI::TargetCostKind CostKind)
+#endif
   {
       const Function* F = dyn_cast<Function>(U);
       if(F != nullptr)
diff --git a/IGC/Compiler/GenTTI.h b/IGC/Compiler/GenTTI.h
index bab1a5c4a..0b3bf4541 100644
--- a/IGC/Compiler/GenTTI.h
+++ b/IGC/Compiler/GenTTI.h
@@ -71,8 +71,12 @@ namespace llvm
             , const User * U
 #endif
         );
+#else
+#if LLVM_VERSION_MAJOR >= 13
+       InstructionCost getUserCost(const User *U, ArrayRef<const Value *> Operands,
 #else
        int getUserCost(const User *U, ArrayRef<const Value *> Operands,
+#endif
                       TTI::TargetCostKind CostKind);
 #endif
 
diff --git a/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp b/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp
index e7995ebb4..035bfba85 100644
--- a/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp
+++ b/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp
@@ -880,7 +880,11 @@ void BIImport::removeFunctionBitcasts(Module& M)
                                 pDstFunc,
                                 funcTobeChanged,
                                 operandMap,
+#if LLVM_VERSION_MAJOR >= 13
+                                CloneFunctionChangeType::LocalChangesOnly,
+#else
                                 false,
+#endif
                                 Returns,
                                 "");
 
diff --git a/IGC/Compiler/Optimizer/CodeAssumption.cpp b/IGC/Compiler/Optimizer/CodeAssumption.cpp
index e7208a5fa..3ee9bddca 100644
--- a/IGC/Compiler/Optimizer/CodeAssumption.cpp
+++ b/IGC/Compiler/Optimizer/CodeAssumption.cpp
@@ -272,7 +272,12 @@ bool CodeAssumption::addAssumption(Function* F, AssumptionCache* AC)
                     // Register assumption
                     if (AC)
                     {
+#if LLVM_VERSION_MAJOR >= 13
+                        if (auto *aI = dyn_cast<AssumeInst>(assumeInst))
+                            AC->registerAssumption(aI);
+#else
                         AC->registerAssumption(assumeInst);
+#endif
                     }
 
                     assumptionAdded[PN] = 1;
diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
index a2b5927ea..1516e40e8 100644
--- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
@@ -7,6 +7,9 @@ SPDX-License-Identifier: MIT
 ============================= end_copyright_notice ===========================*/
 
 #include "llvm/Config/llvm-config.h"
+#if LLVM_VERSION_MAJOR >= 13
+#include <llvm/Analysis/AliasAnalysis.h>
+#endif
 #include <llvm/Analysis/TargetLibraryInfo.h>
 #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h"
 #include "Compiler/CodeGenPublic.h"
@@ -45,7 +48,11 @@ namespace {
             PointerType* PtrTy2 = dyn_cast<PointerType>(LocB.Ptr->getType());
 
             if (!PtrTy1 || !PtrTy2)
+#if LLVM_VERSION_MAJOR >= 13
+                return AliasResult::Kind::NoAlias;
+#else
                 return NoAlias;
+#endif
 
             unsigned AS1 = PtrTy1->getAddressSpace();
             unsigned AS2 = PtrTy2->getAddressSpace();
@@ -62,21 +69,33 @@ namespace {
                 AS1 != ADDRESS_SPACE_GENERIC &&
                 AS2 != ADDRESS_SPACE_GENERIC &&
                 AS1 != AS2)
+#if LLVM_VERSION_MAJOR >= 13
+                return AliasResult::Kind::NoAlias;
+#else
                 return NoAlias;
+#endif
 
 
             // Shared local memory doesn't alias any statefull memory.
             if ((AS1 == ADDRESS_SPACE_LOCAL && AS2 > ADDRESS_SPACE_NUM_ADDRESSES) ||
                 (AS1 > ADDRESS_SPACE_NUM_ADDRESSES && AS2 == ADDRESS_SPACE_LOCAL))
             {
+#if LLVM_VERSION_MAJOR >= 13
+                return AliasResult::Kind::NoAlias;
+#else
                 return NoAlias;
+#endif
             }
 
             // Private memory doesn't alias any stateful memory
             if ((AS1 == ADDRESS_SPACE_PRIVATE && AS2 > ADDRESS_SPACE_NUM_ADDRESSES) ||
                 (AS1 > ADDRESS_SPACE_NUM_ADDRESSES && AS2 == ADDRESS_SPACE_PRIVATE))
             {
+#if LLVM_VERSION_MAJOR >= 13
+                return AliasResult::Kind::NoAlias;
+#else
                 return NoAlias;
+#endif
             }
 
 
@@ -108,7 +127,11 @@ namespace {
                     if ((resourceType[0] != resourceType[1]) || // different resource types
                         (isDirectAccess[0] && isDirectAccess[1] && resourceIndex[0] != resourceIndex[1])) // direct access to different BTIs
                     {
+#if LLVM_VERSION_MAJOR >= 13
+                        return AliasResult::Kind::NoAlias;
+#else
                         return NoAlias;
+#endif
                     }
                 }
             }
diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
index 48c7e8637..8b9618284 100644
--- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
+++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
@@ -17,6 +17,9 @@ SPDX-License-Identifier: MIT
 #include "llvmWrapper/IR/DerivedTypes.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include "llvm/IR/DataLayout.h"
+#if LLVM_VERSION_MAJOR >= 13
+#include "llvm/IR/DebugInfo.h"
+#endif
 #include "llvm/IR/DebugInfoMetadata.h"
 #include "llvm/IR/Dominators.h"
 #include "common/LLVMWarningsPop.hpp"
diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp
index f57dd72cb..d984fe86f 100644
--- a/IGC/DebugInfo/DwarfDebug.cpp
+++ b/IGC/DebugInfo/DwarfDebug.cpp
@@ -857,9 +857,17 @@ CompileUnit* DwarfDebug::constructCompileUnit(DICompileUnit* DIUnit)
                 {
                     std::string str;
                     str = "Intel OpenCL ";
+#if LLVM_VERSION_MAJOR >= 13
+                    str += toString(op1->getValue()->getUniqueInteger(), 10, false);
+#else
                     str += op1->getValue()->getUniqueInteger().toString(10, false);
+#endif
                     str += ".";
+#if LLVM_VERSION_MAJOR >= 13
+                    str += toString(op2->getValue()->getUniqueInteger(), 10, false);
+#else
                     str += op2->getValue()->getUniqueInteger().toString(10, false);
+#endif
 
                     NewCU->addString(Die, dwarf::DW_AT_description, llvm::StringRef(str));
                 }
diff --git a/IGC/DebugInfo/StreamEmitter.cpp b/IGC/DebugInfo/StreamEmitter.cpp
index a38a445d5..e9a5b6279 100644
--- a/IGC/DebugInfo/StreamEmitter.cpp
+++ b/IGC/DebugInfo/StreamEmitter.cpp
@@ -391,11 +391,23 @@ StreamEmitter::StreamEmitter(raw_pwrite_stream& outStream,
 
     MCRegisterInfo* regInfo = nullptr;
 
+    Triple triple = Triple(GetTargetTriple());
+
+#if LLVM_VERSION_MAJOR >= 13
+    // Create new MC context
+    m_pContext = new MCContext(Triple(GetTargetTriple()),
+                               (const llvm::MCAsmInfo*)m_pAsmInfo, regInfo,
+                               /*MSTI=*/(const llvm::MCSubtargetInfo *)nullptr, m_pSrcMgr);
+
+    m_pObjFileInfo->initMCObjectFileInfo(*m_pContext, false);
+
+    m_pContext->setObjectFileInfo(m_pObjFileInfo);
+#else
     // Create new MC context
     m_pContext = new MCContext((const llvm::MCAsmInfo*)m_pAsmInfo, regInfo, m_pObjFileInfo, m_pSrcMgr);
 
-    Triple triple = Triple(GetTargetTriple());
     m_pObjFileInfo->InitMCObjectFileInfo(Triple(GetTargetTriple()), false, *m_pContext);
+#endif
 
     bool is64Bit = GetPointerSize() == 8;
     uint8_t osABI = MCELFObjectTargetWriter::getOSABI(triple.getOS());
diff --git a/IGC/ElfPackager/main.cpp b/IGC/ElfPackager/main.cpp
index 38a5001c1..5f4d87d96 100644
--- a/IGC/ElfPackager/main.cpp
+++ b/IGC/ElfPackager/main.cpp
@@ -177,7 +177,11 @@ std::unique_ptr<IGCLLVM::Module> LocalCloneModule(
             }
 
             SmallVector<ReturnInst*, 8> Returns;  // Ignore returns cloned.
+#if LLVM_VERSION_MAJOR >= 13
+            CloneFunctionInto(F, &*I, VMap, CloneFunctionChangeType::DifferentModule, Returns);
+#else
             CloneFunctionInto(F, &*I, VMap, /*ModuleLevelChanges=*/true, Returns);
+#endif
         }
 
         if (I->hasPersonalityFn())
diff --git a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
index b5f66f048..568b42c07 100644
--- a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
+++ b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
@@ -5028,7 +5028,7 @@ llvm::Value* LLVM3DBuilder<preserveNames, T, Inserter>::ScalarsToVector(
     IGC_ASSERT(nullptr != resultType);
     llvm::Value* result = llvm::UndefValue::get(resultType);
 
-    for (unsigned i = 0; i < llvm::cast<llvm::VectorType>(resultType)->getNumElements(); i++)
+    for (unsigned i = 0; i < llvm::cast<IGCLLVM::FixedVectorType>(resultType)->getNumElements(); i++)
     {
         IGC_ASSERT(nullptr != scalars[i]);
         IGC_ASSERT(llvm::cast<llvm::VectorType>(resultType)->getElementType() == scalars[i]->getType());
diff --git a/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h b/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h
index f90bc1bc0..8ce06e93f 100644
--- a/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h
+++ b/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h
@@ -97,7 +97,11 @@ public:
   bool shouldBuildLookupTables() { return false; }
   unsigned getFlatAddressSpace() { return 4; }
 
+#if LLVM_VERSION_MAJOR >= 13
+  InstructionCost getUserCost(const User *U, ArrayRef<const Value *> Operands
+#else
   int getUserCost(const User *U, ArrayRef<const Value *> Operands
+#endif
 #if LLVM_VERSION_MAJOR >= 11
                   ,
                   TTI::TargetCostKind CostKind
diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
index 1df041372..022141d15 100644
--- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
@@ -26,7 +26,7 @@ namespace IGCLLVM
     {
         return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
     }
-#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 12
+#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 13
     inline static llvm::Pass * createLoopUnrollPass(
         int OptLevel = 2, int Threshold = -1, int Count = -1,
         int AllowPartial = -1, int Runtime = -1,
diff --git a/IGC/common/LLVMUtils.cpp b/IGC/common/LLVMUtils.cpp
index ed2cfc413..ae9df5d63 100644
--- a/IGC/common/LLVMUtils.cpp
+++ b/IGC/common/LLVMUtils.cpp
@@ -132,7 +132,11 @@ bool IGCPassManager::isInList(const StringRef& N, const StringRef& List) const
         size_t endPos = List.find_first_of(Separators, startPos);
         size_t len = (endPos != StringRef::npos ? endPos - startPos : endPos);
         StringRef Name = List.substr(startPos, len);
+#if LLVM_VERSION_MAJOR >= 13
+        if (Name.equals_insensitive(N))
+#else
         if (Name.equals_lower(N))
+#endif
         {
             return true;
         }
@@ -149,7 +153,11 @@ bool IGCPassManager::isPrintBefore(Pass* P)
         //                         or pass command args registered in passInfo.
         StringRef  passNameList(IGC_GET_REGKEYSTRING(PrintBefore));
         StringRef PN = P->getPassName();
+#if LLVM_VERSION_MAJOR >= 13
+        if (passNameList.equals_insensitive("all") || isInList(PN, passNameList))
+#else
         if (passNameList.equals_lower("all") || isInList(PN, passNameList))
+#endif
             return true;
 
         // further check passInfo
@@ -173,7 +181,11 @@ bool IGCPassManager::isPrintAfter(Pass* P)
         //                         or pass command args registered in passInfo.
         StringRef  passNameList(IGC_GET_REGKEYSTRING(PrintAfter));
         StringRef PN = P->getPassName();
+#if LLVM_VERSION_MAJOR >= 13
+        if (passNameList.equals_insensitive("all") || isInList(PN, passNameList))
+#else
         if (passNameList.equals_lower("all") || isInList(PN, passNameList))
+#endif
             return true;
 
         // further check passInfo
diff --git a/visa/iga/IGALibrary/IR/BitSet.hpp b/visa/iga/IGALibrary/IR/BitSet.hpp
index 43b0d3f92..c6cdd430a 100644
--- a/visa/iga/IGALibrary/IR/BitSet.hpp
+++ b/visa/iga/IGALibrary/IR/BitSet.hpp
@@ -12,6 +12,8 @@ SPDX-License-Identifier: MIT
 #include "../asserts.hpp"
 #include "common/secure_mem.h"
 
+#include <stdexcept>
+#include <limits>
 #include <algorithm>
 #include <bitset>
 #include <cstdint>
-- 
2.31.1