Skip to content

Commit 13ca288

Browse files
michalkr52igcbot
authored andcommitted
Replace outdated IGC_LLVM_TRUNK_REVISION checks and vc-intrinsics patches
Replaced current, outdated IGC_LLVM_TRUNK_REVISION checks and vc-intrinsics patches to align with the next LLVM 16 to 17 interim period. Analogically, replaced vc-intrinsics and LLVM patches to match the next interim period. Added a workaround for SPIRV-LLVM-Translator versioning in build and packaging scripts.
1 parent 95c25a9 commit 13ca288

40 files changed

+542
-132
lines changed

IGC/BiFManager/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main(int argc, char *argv[]) {
5353
printf("[BiFManager] - Disabling Opaque Pointers\n");
5454
}
5555

56-
#if LLVM_VERSION_MAJOR < 17
56+
#if LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)
5757
Context.setOpaquePointers(enableOpaquePointers);
5858
#endif
5959
#endif

IGC/OCLFE/igd_fcl_mcl/headers/clang_tb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ bool GetFCLShaderDumpPidDisable();
149149
bool GetFCLDumpToCurrentDir();
150150
bool GetFCLDumpToCustomDir();
151151
bool GetFCLEnableKernelNamesBasedHash();
152-
#if LLVM_VERSION_MAJOR <= 16
152+
#if LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)
153153
bool GetFCLEnableOpaquePointersBackend();
154154
#endif
155155
} // namespace FCL

IGC/OCLFE/igd_fcl_mcl/source/clang_tb.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int32_t FCLDumpToCurrDir = 0;
7676
int32_t FCLDumpToCustomDir = 0;
7777
int32_t FCLShDumpPidDis = 0;
7878
int32_t FCLEnableKernelNamesBasedHash = 0;
79-
#if LLVM_VERSION_MAJOR <= 16
79+
#if LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)
8080
int32_t FCLEnableOpaquePointersBackend = 0;
8181
#endif
8282
int32_t FCLEnvKeysRead = 0;
@@ -161,7 +161,7 @@ void FCLReadKeysFromEnv() {
161161
(RegKeysFlagsFromOptions.find("ShaderDumpPidDisable=1") != std::string::npos);
162162
FCLEnableKernelNamesBasedHash = getFCLIGCBinaryKey("EnableKernelNamesBasedHash") ||
163163
(RegKeysFlagsFromOptions.find("EnableKernelNamesBasedHash=1") != std::string::npos);
164-
#if LLVM_VERSION_MAJOR <= 16
164+
#if LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)
165165
FCLEnableOpaquePointersBackend =
166166
getFCLIGCBinaryKey("EnableOpaquePointersBackend") ||
167167
(RegKeysFlagsFromOptions.find("EnableOpaquePointersBackend=1") != std::string::npos);
@@ -195,7 +195,7 @@ bool GetFCLEnableKernelNamesBasedHash() {
195195
return FCLEnableKernelNamesBasedHash;
196196
}
197197

198-
#if LLVM_VERSION_MAJOR <= 16
198+
#if LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)
199199
bool GetFCLEnableOpaquePointersBackend() {
200200
FCLReadKeysFromEnv();
201201
return FCLEnableOpaquePointersBackend;
@@ -1381,16 +1381,16 @@ bool CClangTranslationBlock::TranslateClang(const TranslateClangArgs *pInputArgs
13811381
optionsEx += " -debug-info-kind=line-tables-only -dwarf-version=4";
13821382
}
13831383

1384-
#if LLVM_VERSION_MAJOR <= 16 && defined(IGC_DEBUG_VARIABLES)
1384+
#if (LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)) && defined(IGC_DEBUG_VARIABLES)
13851385
// Allow to dynamically switch from typed to opaque pointers on
1386-
// LLVM <= 16. Disabling opaque pointers dynamically is not possible.
1386+
// LLVM < 17. Disabling opaque pointers dynamically is not possible.
13871387
if (FCL_IGC_IS_FLAG_ENABLED(EnableOpaquePointersBackend)) {
13881388
optionsEx += " -opaque-pointers";
13891389
} else {
13901390
#endif
13911391
optionsEx += " ";
13921392
optionsEx += __IGC_OPAQUE_POINTERS_DEFAULT_ARG_CLANG;
1393-
#if LLVM_VERSION_MAJOR <= 16 && defined(IGC_DEBUG_VARIABLES)
1393+
#if (LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)) && defined(IGC_DEBUG_VARIABLES)
13941394
}
13951395
#endif
13961396

IGC/VectorCompiler/lib/Driver/Driver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,17 +455,17 @@ static void optimizeIR(const vc::CompileOptions &Opts,
455455
else
456456
OptLevel = llvm::OptimizationLevel::O2;
457457

458-
#if LLVM_VERSION_MAJOR < 17
458+
#if LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)
459459
// On llvm-16 a separate method must be used to build default O0 pipeline,
460460
// otherwise it hits an assertion.
461461
llvm::ModulePassManager MPM;
462462
if (OptLevel == llvm::OptimizationLevel::O0)
463463
MPM = PB.buildO0DefaultPipeline(OptLevel);
464464
else
465465
MPM = PB.buildPerModuleDefaultPipeline(OptLevel);
466-
#else // LLVM_VERSION_MAJOR < 17
466+
#else // LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)
467467
llvm::ModulePassManager MPM = PB.buildPerModuleDefaultPipeline(OptLevel);
468-
#endif // LLVM_VERSION_MAJOR < 17
468+
#endif // LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)
469469

470470
MPM.run(M, MAM);
471471
#endif // LLVM_VERSION_MAJOR < 16

IGC/WrapperLLVM/include/llvmWrapper/ADT/APInt.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SPDX-License-Identifier: MIT
1717
namespace IGCLLVM {
1818
using SignedDivisionByConstantInfo = llvm::SignedDivisionByConstantInfo;
1919
using UnsignedDivisionByConstantInfo =
20-
#if (LLVM_VERSION_MAJOR == 14) || defined(IGC_LLVM_TRUNK_REVISION)
20+
#if (LLVM_VERSION_MAJOR == 14)
2121
// Account for a typo
2222
llvm::UnsignedDivisonByConstantInfo;
2323
#else // LLVM_VERSION_MAJOR == 14
@@ -55,4 +55,4 @@ inline llvm::APInt MagicNumber(const UnsignedDivisionByConstantInfo &mu) { retur
5555
inline llvm::APInt MagicNumber(const SignedDivisionByConstantInfo &ms) { return ms.Magic; }
5656
} // namespace IGCLLVM
5757

58-
#endif
58+
#endif

IGC/WrapperLLVM/include/llvmWrapper/ADT/Optional.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SPDX-License-Identifier: MIT
99
#ifndef IGCLLVM_ADT_OPTIONAL_H
1010
#define IGCLLVM_ADT_OPTIONAL_H
1111

12-
#if LLVM_VERSION_MAJOR < 17
12+
#if LLVM_VERSION_MAJOR < 17 || defined(IGC_LLVM_TRUNK_REVISION)
1313
#include <llvm/ADT/Optional.h>
1414
#endif
1515
#include <optional>

IGC/WrapperLLVM/include/llvmWrapper/ADT/StringRef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace IGCLLVM {
1616
inline bool equals_insensitive(llvm::StringRef LHS, llvm::StringRef RHS) { return LHS.equals_insensitive(RHS); }
1717

1818
inline bool ends_with_insensitive(llvm::StringRef LHS, llvm::StringRef RHS) {
19-
#if LLVM_VERSION_MAJOR > 16
19+
#if LLVM_VERSION_MAJOR > 16 && !defined(IGC_LLVM_TRUNK_REVISION)
2020
return LHS.ends_with_insensitive(RHS);
2121
#else
2222
return LHS.endswith_insensitive(RHS);

IGC/WrapperLLVM/include/llvmWrapper/Analysis/InstructionSimplify.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SPDX-License-Identifier: MIT
1313
#include "llvm/Analysis/InstructionSimplify.h"
1414

1515
namespace IGCLLVM {
16-
#if (LLVM_VERSION_MAJOR < 15) || defined(IGC_LLVM_TRUNK_REVISION)
16+
#if (LLVM_VERSION_MAJOR < 15)
1717
inline llvm::Value *simplifyInstruction(llvm::Instruction *I, const llvm::SimplifyQuery &Q,
1818
llvm::OptimizationRemarkEmitter *ORE = nullptr) {
1919
return llvm::SimplifyInstruction(I, Q, ORE);
@@ -22,15 +22,15 @@ inline llvm::Value *simplifyInstruction(llvm::Instruction *I, const llvm::Simpli
2222
using llvm::simplifyInstruction;
2323
#endif
2424

25-
#if (LLVM_VERSION_MAJOR < 15) || defined(IGC_LLVM_TRUNK_REVISION)
25+
#if (LLVM_VERSION_MAJOR < 15)
2626
inline llvm::Value *simplifyBinOp(unsigned Opcode, llvm::Value *LHS, llvm::Value *RHS, const llvm::SimplifyQuery &Q) {
2727
return llvm::SimplifyBinOp(Opcode, LHS, RHS, Q);
2828
}
2929
#else
3030
using llvm::simplifyBinOp;
3131
#endif
3232

33-
#if (LLVM_VERSION_MAJOR < 15) || defined(IGC_LLVM_TRUNK_REVISION)
33+
#if (LLVM_VERSION_MAJOR < 15)
3434
inline llvm::Value *simplifyCall(llvm::CallBase *Call, const llvm::SimplifyQuery &Q) {
3535
return llvm::SimplifyCall(Call, Q);
3636
}

IGC/WrapperLLVM/include/llvmWrapper/IR/ConstantFold.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ SPDX-License-Identifier: MIT
1111

1212
#include "llvm/Config/llvm-config.h"
1313
#include "llvm/IR/Constants.h"
14-
#if (LLVM_VERSION_MAJOR >= 15) && !defined(IGC_LLVM_TRUNK_REVISION)
14+
#if (LLVM_VERSION_MAJOR >= 15)
1515
#include "llvm/IR/ConstantFold.h"
1616
#endif
1717

1818
namespace IGCLLVM {
1919
inline llvm::Constant *ConstantFoldExtractValueInstruction(llvm::Constant *Agg, llvm::ArrayRef<unsigned> Idxs,
2020
llvm::Type *OnlyIfReducedTy = nullptr) {
21-
#if (LLVM_VERSION_MAJOR < 15) || defined(IGC_LLVM_TRUNK_REVISION)
21+
#if (LLVM_VERSION_MAJOR < 15)
2222
return llvm::ConstantExpr::getExtractValue(Agg, Idxs, OnlyIfReducedTy);
2323
#else
2424
return llvm::ConstantFoldExtractValueInstruction(Agg, Idxs);
@@ -28,15 +28,15 @@ inline llvm::Constant *ConstantFoldExtractValueInstruction(llvm::Constant *Agg,
2828
inline llvm::Constant *ConstantFoldInsertValueInstruction(llvm::Constant *Agg, llvm::Constant *Val,
2929
llvm::ArrayRef<unsigned> Idxs,
3030
llvm::Type *OnlyIfReducedTy = nullptr) {
31-
#if (LLVM_VERSION_MAJOR < 15) || defined(IGC_LLVM_TRUNK_REVISION)
31+
#if (LLVM_VERSION_MAJOR < 15)
3232
return llvm::ConstantExpr::getInsertValue(Agg, Val, Idxs, OnlyIfReducedTy);
3333
#else
3434
return llvm::ConstantFoldInsertValueInstruction(Agg, Val, Idxs);
3535
#endif
3636
}
3737

3838
inline llvm::Constant *ConstantFoldBinaryInstruction(unsigned Opcode, llvm::Constant *V1, llvm::Constant *V2) {
39-
#if (LLVM_VERSION_MAJOR < 15) || defined(IGC_LLVM_TRUNK_REVISION)
39+
#if (LLVM_VERSION_MAJOR < 15)
4040
// TODO: Add other opcodes as needed
4141
switch (Opcode) {
4242
case llvm::Instruction::SDiv:
@@ -54,4 +54,4 @@ inline llvm::Constant *ConstantFoldBinaryInstruction(unsigned Opcode, llvm::Cons
5454
}
5555
} // namespace IGCLLVM
5656

57-
#endif // IGCLLVM_IR_CONSTANT_FOLD_H
57+
#endif // IGCLLVM_IR_CONSTANT_FOLD_H

IGC/WrapperLLVM/include/llvmWrapper/IR/ConstantFolder.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ConstantFolderBase : public llvm::IRBuilderFolder {
4242
/// up to LLVM 14.
4343
/// -------------------------------------------------------------------
4444

45-
#if (LLVM_VERSION_MAJOR < 15) || defined(IGC_LLVM_TRUNK_REVISION)
45+
#if (LLVM_VERSION_MAJOR < 15)
4646

4747
// Note: for direct usage in code, prefer `CreateBinOp` wrapper for all
4848
// LLVM versions up to 15.
@@ -190,14 +190,14 @@ class ConstantFolderBase : public llvm::IRBuilderFolder {
190190
llvm::ArrayRef<unsigned> IdxList) const override {
191191
return m_baseConstantFolder.CreateInsertValue(Agg, Val, IdxList);
192192
}
193-
#endif // (LLVM_VERSION_MAJOR < 15) || defined(IGC_LLVM_TRUNK_REVISION)
193+
#endif // (LLVM_VERSION_MAJOR < 15)
194194

195195
/// -------------------------------------------------------------------
196196
/// This block defines virtual methods that are present in the base
197197
/// llvm::IRBuilderFolder class starting from LLVM 15.
198198
/// -------------------------------------------------------------------
199199

200-
#if (LLVM_VERSION_MAJOR >= 15) && !defined(IGC_LLVM_TRUNK_REVISION)
200+
#if (LLVM_VERSION_MAJOR >= 15)
201201
inline llvm::Value *FoldBinOp(llvm::Instruction::BinaryOps Opc, llvm::Value *LHS, llvm::Value *RHS) const override {
202202
return m_baseConstantFolder.FoldBinOp(Opc, LHS, RHS);
203203
}
@@ -252,7 +252,7 @@ class ConstantFolderBase : public llvm::IRBuilderFolder {
252252
/// -------------------------------------------------------------------
253253

254254
inline llvm::Constant *CreateBinOp(llvm::Instruction::BinaryOps Opc, llvm::Constant *LHS, llvm::Constant *RHS) const
255-
#if (LLVM_VERSION_MAJOR < 15) || defined(IGC_LLVM_TRUNK_REVISION)
255+
#if (LLVM_VERSION_MAJOR < 15)
256256
override {
257257
return m_baseConstantFolder.CreateBinOp(Opc, LHS, RHS);
258258
}

0 commit comments

Comments
 (0)