summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDongwon Kim <dongwon.kim@intel.com>2021-08-23 20:27:50 -0700
committerAnuj Mittal <anuj.mittal@intel.com>2021-08-24 16:05:35 +0800
commit6f8e742aab2526a35aafc671d2197bf4604bae26 (patch)
tree2e7f8f62338178072114f05546ec595eab0bf0f2
parent6a628fa0b507eefd3ed1608b39f4702ea56d1093 (diff)
downloadmeta-intel-6f8e742aab2526a35aafc671d2197bf4604bae26.tar.gz
intel-graphics-compiler: update IGC to 1.0.8365
Updating IGC to add ADL-P support. All patches under files folder are rebased as well. Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-skip-execution-of-ElfPackager.patch45
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-IGC-VectorCompiler-CMakeLists.txt-link-to-external-L.patch47
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch318
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Improve-Reproducibility-for-src-package.patch (renamed from dynamic-layers/clang-layer/recipes-opencl/igc/files/improve_src_package_reproducibility.patch)10
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Review-fixes-for-LLVM-12-phase-2.patch123
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0004-find-external-llvm-tblgen.patch30
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/0005-Temporary-LLVM-12-compatiblity-fix.patch (renamed from dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-Fix-build-with-LLVM-12.patch)1049
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/files/link-to-LLVMGenXIntrinsics.patch71
-rw-r--r--dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.8365.bb (renamed from dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.6646.bb)15
9 files changed, 617 insertions, 1091 deletions
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
index 65342d9c..b77823b8 100644
--- 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
@@ -1,7 +1,7 @@
1From 5501fab763aa2b11437fbdb19e07a11157a7d3e6 Mon Sep 17 00:00:00 2001 1From 562a19fe7ef3f4732365efdfc6d2a30763a5b8b0 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com> 2From: Dongwon Kim <dongwon.kim@intel.com>
3Date: Thu, 6 Feb 2020 14:56:56 +0800 3Date: Wed, 18 Aug 2021 18:49:49 -0700
4Subject: [PATCH] skip execution of ElfPackager 4Subject: [PATCH 1/5] skip execution of ElfPackager
5 5
6ElfPackager adds the ability to convert llvm bitcode into elf files for 6ElfPackager adds the ability to convert llvm bitcode into elf files for
7easier partitioning. Skip for now until we start building a native 7easier partitioning. Skip for now until we start building a native
@@ -11,33 +11,34 @@ Upstream-Status: Inappropriate [configuration specific]
11 11
12Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> 12Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
13Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> 13Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
14Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
14--- 15---
15 IGC/ElfPackager/CMakeLists.txt | 12 ++++++------ 16 IGC/ElfPackager/CMakeLists.txt | 12 ++++++------
16 1 file changed, 6 insertions(+), 6 deletions(-) 17 1 file changed, 6 insertions(+), 6 deletions(-)
17 18
18diff --git a/IGC/ElfPackager/CMakeLists.txt b/IGC/ElfPackager/CMakeLists.txt 19diff --git a/IGC/ElfPackager/CMakeLists.txt b/IGC/ElfPackager/CMakeLists.txt
19index 563ac9d6..c6c74ce9 100644 20index 8959a3ebb..7c3a0b42f 100644
20--- a/IGC/ElfPackager/CMakeLists.txt 21--- a/IGC/ElfPackager/CMakeLists.txt
21+++ b/IGC/ElfPackager/CMakeLists.txt 22+++ b/IGC/ElfPackager/CMakeLists.txt
22@@ -71,12 +71,12 @@ include_directories ( 23@@ -51,12 +51,12 @@ if(NOT TARGET ${IGC_BUILD__PROJ__ElfPackager})
23 ${IGC_SOURCE_DIR}/AdaptorOCL/CLElfLib/ 24 ${IGC_SOURCE_DIR}/AdaptorOCL/CLElfLib/
24 ) 25 )
25 26
26-if(NOT ANDROID) 27- if(NOT ANDROID)
27- add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager} 28- add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager}
28- POST_BUILD 29- POST_BUILD
29- 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 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
30- ) 31- )
31-endif() 32- endif()
32+#if(NOT ANDROID) 33+# if(NOT ANDROID)
33+# add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager} 34+# add_custom_command(TARGET ${IGC_BUILD__PROJ__ElfPackager}
34+# POST_BUILD 35+# POST_BUILD
35+# 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 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
36+# ) 37+# )
37+#endif() 38+# endif()
38 39
39 40
40 add_dependencies("${IGC_BUILD__PROJ__ElfPackager}" "${IGC_BUILD__PROJ__BiFModule_OCL}") 41 add_dependencies("${IGC_BUILD__PROJ__ElfPackager}" "${IGC_BUILD__PROJ__BiFModule_OCL}")
41-- 42--
422.17.1 432.20.1
43 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
new file mode 100644
index 00000000..db834c99
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-IGC-VectorCompiler-CMakeLists.txt-link-to-external-L.patch
@@ -0,0 +1,47 @@
1From 92a663dd55917fdfad5ae4daa173a9d18df0ee9e Mon Sep 17 00:00:00 2001
2From: Dongwon Kim <dongwon.kim@intel.com>
3Date: Wed, 18 Aug 2021 19:14:28 -0700
4Subject: [PATCH 2/5] IGC/VectorCompiler/CMakeLists.txt: link to external
5 LLVMGenXIntrinsics
6
7By default LLVMGenXIntrinsics is to be build In-tree, but we want to
8link externally.
9
10Upstream-Status: Inappropriate [configuration specific]
11
12Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
13Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
14---
15 IGC/VectorCompiler/CMakeLists.txt | 16 ----------------
16 1 file changed, 16 deletions(-)
17
18diff --git a/IGC/VectorCompiler/CMakeLists.txt b/IGC/VectorCompiler/CMakeLists.txt
19index 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--
462.20.1
47
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch
deleted file mode 100644
index 6580df75..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-Review-fixes-for-LLVM-12-phase-1.patch
+++ /dev/null
@@ -1,318 +0,0 @@
1From 60136b453bb3a109bfc88c4040b871af9d522ed5 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
3Date: Thu, 25 Feb 2021 19:40:21 +0100
4Subject: [PATCH 2/3] Review fixes for LLVM 12 phase 1
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Upstream-Status: Pending
10
11Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
12Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
13---
14 IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 6 +-----
15 IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 6 +-----
16 IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | 7 ++-----
17 IGC/Compiler/CISACodeGen/Simd32Profitability.cpp | 7 ++-----
18 IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | 11 +----------
19 IGC/Compiler/GenTTI.cpp | 9 ++-------
20 IGC/Compiler/Legalizer/InstPromoter.cpp | 8 +-------
21 .../DeviceEnqueueFuncs/TransformBlocks.cpp | 6 +-----
22 .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp | 4 ----
23 IGC/Compiler/Optimizer/Scalarizer.cpp | 2 +-
24 IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h | 10 ++++++++++
25 .../include/llvmWrapper/Support/TypeSize.h | 4 +---
26 .../include/llvmWrapper/Transforms/Utils/LoopUtils.h | 8 ++++++++
27 IGC/common/igc_resourceDimTypes.h | 5 ++---
28 14 files changed, 33 insertions(+), 60 deletions(-)
29
30diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
31index 725a1512..12f42be8 100644
32--- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
33+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
34@@ -1929,11 +1929,7 @@ SPIRVToLLVM::transType(SPIRVType *T) {
35 auto name = isSubgroupAvcINTELTypeOpCode(OC) ?
36 OCLSubgroupINTELTypeOpCodeMap::rmap(OC) :
37 BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC);
38-#if LLVM_VERSION_MAJOR >= 12
39- auto *pST = llvm::StructType::getTypeByName(M->getContext(), name);
40-#else
41- auto *pST = M->getTypeByName(name);
42-#endif
43+ auto *pST = IGCLLVM::getTypeByName(M, name);
44 pST = pST ? pST : StructType::create(*Context, name);
45
46 return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC)));
47diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
48index 91b4623c..f4f0dee5 100644
49--- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
50+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
51@@ -93,11 +93,7 @@ saveLLVMModule(Module *M, const std::string &OutputFile) {
52 PointerType*
53 getOrCreateOpaquePtrType(Module *M, const std::string &Name,
54 unsigned AddrSpace) {
55-#if LLVM_VERSION_MAJOR >= 12
56- auto OpaqueType = llvm::StructType::getTypeByName(M->getContext(), Name);
57-#else
58- auto OpaqueType = M->getTypeByName(Name);
59-#endif
60+ auto OpaqueType = IGCLLVM::getTypeByName(M, Name);
61 if (!OpaqueType)
62 OpaqueType = StructType::create(M->getContext(), Name);
63 return PointerType::get(OpaqueType, AddrSpace);
64diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
65index fc45a510..a612a473 100644
66--- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
67+++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
68@@ -33,6 +33,7 @@ IN THE SOFTWARE.
69 #include <llvm/Support/Debug.h>
70 #include <llvm/Support/raw_ostream.h>
71 #include <llvm/Transforms/Utils/Local.h>
72+#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
73 #include "common/LLVMWarningsPop.hpp"
74 #include "GenISAIntrinsics/GenIntrinsics.h"
75 #include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
76@@ -134,11 +135,7 @@ bool AdvMemOpt::runOnFunction(Function& F) {
77 for (auto I = LI->begin(), E = LI->end(); I != E; ++I)
78 for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) {
79 Loop* L = *DFI;
80-#if LLVM_VERSION_MAJOR >= 12
81- if (L->isInnermost())
82-#else
83- if (L->empty())
84-#endif
85+ if (IGCLLVM::isInnermost(L))
86 InnermostLoops.push_back(L);
87 }
88
89diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
90index c1f4a419..5393d4e8 100644
91--- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
92+++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
93@@ -28,6 +28,7 @@ IN THE SOFTWARE.
94 #include "Compiler/CISACodeGen/Platform.hpp"
95 #include "common/LLVMWarningsPush.hpp"
96 #include <llvmWrapper/IR/DerivedTypes.h>
97+#include <llvmWrapper/Transforms/Utils/LoopUtils.h>
98 #include <llvm/IR/InstIterator.h>
99 #include <llvm/IR/Operator.h>
100 #include <llvmWrapper/IR/DerivedTypes.h>
101@@ -995,11 +996,7 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI)
102 // Collect innermost simple loop.
103 for (auto I = LI->begin(), E = LI->end(); I != E; ++I) {
104 auto L = *I;
105-#if LLVM_VERSION_MAJOR >= 12
106- if (!L->isInnermost())
107-#else
108- if (!L->empty())
109-#endif
110+ if (!IGCLLVM::isInnermost(L))
111 continue;
112 if (L->getNumBlocks() != 2)
113 continue;
114diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
115index adf992cb..33473c23 100644
116--- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
117+++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
118@@ -153,21 +153,12 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
119 // In OGL there are uses of ldmcs other then ldms, using vec4float type.
120 // Fix them to use newly created 16bit ldmcs.
121 if (ldmcs->getType()->isVectorTy() &&
122-#if LLVM_VERSION_MAJOR >= 12
123- ldmcs->getType()->getScalarType()->isFloatTy())
124-#else
125- ldmcs->getType()->getVectorElementType()->isFloatTy())
126-#endif
127+ cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getElementType()->isFloatTy())
128 {
129 m_builder->SetInsertPoint(ldmcs);
130
131-#if LLVM_VERSION_MAJOR >= 12
132 uint ldmcsNumOfElements = cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements();
133 uint new_mcs_callNumOfElements = cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements();
134-#else
135- uint ldmcsNumOfElements = ldmcs->getType()->getVectorNumElements();
136- uint new_mcs_callNumOfElements = new_mcs_call->getType()->getVectorNumElements();
137-#endif
138
139 // vec of 16bit ints to vec of 32bit ints
140 Type* new_mcs_callVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements);
141diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp
142index 9e4d2f26..53e3ec9e 100644
143--- a/IGC/Compiler/GenTTI.cpp
144+++ b/IGC/Compiler/GenTTI.cpp
145@@ -37,6 +37,7 @@ IN THE SOFTWARE.
146 #include "llvm/Analysis/LoopInfo.h"
147 #include "llvm/Analysis/ScalarEvolution.h"
148 #include "llvm/Support/raw_ostream.h"
149+#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
150 #include "common/LLVMWarningsPop.hpp"
151
152 using namespace llvm;
153@@ -216,13 +217,7 @@ namespace llvm {
154
155 // Skip non-simple loop.
156 if (L->getNumBlocks() != 1) {
157- if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) &&
158-#if LLVM_VERSION_MAJOR >= 12
159- L->isInnermost()
160-#else
161- L->empty()
162-#endif
163- ) {
164+ if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && IGCLLVM::isInnermost(L)) {
165 auto countNonPHI = [](BasicBlock* BB) {
166 unsigned Total = BB->size();
167 unsigned PHIs = 0;
168diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp
169index 8fadf89f..63cbccb5 100644
170--- a/IGC/Compiler/Legalizer/InstPromoter.cpp
171+++ b/IGC/Compiler/Legalizer/InstPromoter.cpp
172@@ -398,13 +398,7 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) {
173 IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N));
174
175 std::vector<Constant*> Vals;
176- for (unsigned i = 0;
177-#if LLVM_VERSION_MAJOR >= 12
178- i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements();
179-#else
180- i < DestTy->getVectorNumElements();
181-#endif
182- i++)
183+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements(); i++)
184 Vals.push_back(IRB->getInt32(i));
185
186 Value* Mask = ConstantVector::get(Vals);
187diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
188index 119520ed..a3681b79 100644
189--- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
190+++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
191@@ -952,11 +952,7 @@ namespace //Anonymous
192 {
193 auto ndrangeStructName = "struct.ndrange_t";
194 auto module = _deviceExecCall->getModule();
195-#if LLVM_VERSION_MAJOR >= 12
196- auto ndrangeTy = llvm::StructType::getTypeByName(module->getContext(), ndrangeStructName);
197-#else
198- auto ndrangeTy = module->getTypeByName(ndrangeStructName);
199-#endif
200+ auto ndrangeTy = IGCLLVM::getTypeByName(module, ndrangeStructName);
201 if (ndrangeTy == nullptr)
202 {
203 //create struct type
204diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
205index 535d6268..c23c661d 100644
206--- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
207+++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
208@@ -303,11 +303,7 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType)
209 auto Size = ElemByteSize;
210 if (DataType->isVectorTy())
211 {
212-#if LLVM_VERSION_MAJOR >= 12
213 Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements();
214-#else
215- Size *= DataType->getVectorNumElements();
216-#endif
217 }
218 unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize;
219 unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2;
220diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp
221index a4e73a6d..38627553 100644
222--- a/IGC/Compiler/Optimizer/Scalarizer.cpp
223+++ b/IGC/Compiler/Optimizer/Scalarizer.cpp
224@@ -778,7 +778,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
225
226 // Generate array for shuffled scalar values
227 SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector;
228- unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
229+ unsigned width = int_cast<unsigned>(cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
230
231 // Generate undef value, which may be needed as some scalar elements
232 UndefValue* undef = UndefValue::get(inputType->getElementType());
233diff --git a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
234index a3f5a0b8..6a5407bb 100644
235--- a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
236+++ b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
237@@ -29,6 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
238
239 #include "llvm/Config/llvm-config.h"
240 #include "llvm/IR/DerivedTypes.h"
241+#include "llvm/IR/Module.h"
242
243 namespace IGCLLVM
244 {
245@@ -62,6 +63,15 @@ namespace IGCLLVM
246 return false;
247 #endif
248 }
249+
250+ inline llvm::StructType *getTypeByName(llvm::Module *M, llvm::StringRef Name) {
251+#if LLVM_VERSION_MAJOR >= 12
252+ return llvm::StructType::getTypeByName(M->getContext(), Name);
253+#else
254+ return M->getTypeByName(Name);
255+#endif
256+ }
257+
258 }
259
260 #endif
261diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
262index 30e29720..7021820c 100644
263--- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
264+++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
265@@ -39,12 +39,10 @@ inline unsigned getElementCount(unsigned EC) { return EC; }
266 inline ElementCount getElementCount(unsigned EC) {
267 return ElementCount(EC, false);
268 }
269-#elif LLVM_VERSION_MAJOR == 12
270+#else
271 inline ElementCount getElementCount(unsigned EC) {
272 return ElementCount::get(EC, false);
273 }
274-#else
275-#error "unsupported LLVM version"
276 #endif
277 } // namespace IGCLLVM
278
279diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
280index db47b00b..bce9cfc1 100644
281--- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
282+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
283@@ -41,6 +41,14 @@ namespace IGCLLVM
284 return llvm::InsertPreheaderForLoop(L, DT, LI, nullptr, PreserveLCSSA);
285 }
286 #endif
287+
288+ inline bool isInnermost(llvm::Loop *L) {
289+#if LLVM_VERSION_MAJOR >= 12
290+ return L->isInnermost();
291+#else
292+ return L->empty();
293+#endif
294+ }
295 }
296
297 #endif
298diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h
299index d790330f..2d675969 100644
300--- a/IGC/common/igc_resourceDimTypes.h
301+++ b/IGC/common/igc_resourceDimTypes.h
302@@ -67,10 +67,9 @@ namespace IGC
303 resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE));
304
305 #if LLVM_VERSION_MAJOR >= 12
306- llvm::LLVMContext& llvmCtx = module.getContext();
307- return llvm::StructType::getTypeByName(llvmCtx, ResourceDimensionTypeName[resourceDimTypeId]);
308+ return llvm::StructType::getTypeByName(module.getContext(), ResourceDimensionTypeName[resourceDimTypeId]);
309 #else
310 return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]);
311 #endif
312 }
313-}
314\ No newline at end of file
315+}
316--
3172.17.1
318
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/improve_src_package_reproducibility.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Improve-Reproducibility-for-src-package.patch
index c694836f..7dd36aec 100644
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/improve_src_package_reproducibility.patch
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Improve-Reproducibility-for-src-package.patch
@@ -1,7 +1,7 @@
1From 2fa3f2da1179bd5b2eeac82839d386f0111e611c Mon Sep 17 00:00:00 2001 1From c2b7f30dd56568482b1b7c2f22bafdf68736fc88 Mon Sep 17 00:00:00 2001
2From: Lee Chee Yang <chee.yang.lee@intel.com> 2From: Lee Chee Yang <chee.yang.lee@intel.com>
3Date: Wed, 2 Sep 2020 08:28:35 +0800 3Date: Wed, 2 Sep 2020 08:28:35 +0800
4Subject: [PATCH] Improve Reproducibility for src package 4Subject: [PATCH 3/5] Improve Reproducibility for src package
5 5
6Improve reproducibility for intel-graphics-compiler-src package. 6Improve reproducibility for intel-graphics-compiler-src package.
7needs to pass build path as environment variable to the build. 7needs to pass build path as environment variable to the build.
@@ -14,10 +14,10 @@ Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
14 1 file changed, 5 insertions(+), 2 deletions(-) 14 1 file changed, 5 insertions(+), 2 deletions(-)
15 15
16diff --git a/visa/CMakeLists.txt b/visa/CMakeLists.txt 16diff --git a/visa/CMakeLists.txt b/visa/CMakeLists.txt
17index 981c35d2..d5944370 100644 17index 65dbb4934..8cd607a69 100644
18--- a/visa/CMakeLists.txt 18--- a/visa/CMakeLists.txt
19+++ b/visa/CMakeLists.txt 19+++ b/visa/CMakeLists.txt
20@@ -109,8 +109,11 @@ endif() 20@@ -123,8 +123,11 @@ endif()
21 set(bison_output_file ${CMAKE_CURRENT_BINARY_DIR}/CISA.tab.cpp) 21 set(bison_output_file ${CMAKE_CURRENT_BINARY_DIR}/CISA.tab.cpp)
22 set(flex_output_file ${CMAKE_CURRENT_BINARY_DIR}/lex.CISA.cpp) 22 set(flex_output_file ${CMAKE_CURRENT_BINARY_DIR}/lex.CISA.cpp)
23 23
@@ -32,5 +32,5 @@ index 981c35d2..d5944370 100644
32 set(CISAScanner_dependencies) 32 set(CISAScanner_dependencies)
33 33
34-- 34--
352.28.0 352.20.1
36 36
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Review-fixes-for-LLVM-12-phase-2.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Review-fixes-for-LLVM-12-phase-2.patch
deleted file mode 100644
index 189c2b3f..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0003-Review-fixes-for-LLVM-12-phase-2.patch
+++ /dev/null
@@ -1,123 +0,0 @@
1From c6d333637537263930acb1b6c5dadb0467d745f6 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
3Date: Fri, 26 Feb 2021 06:39:35 +0100
4Subject: [PATCH 3/3] Review fixes for LLVM 12 phase 2
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Upstream-Status: Pending
10
11Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
12Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
13---
14 IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 4 ----
15 .../AddressSpaceAliasAnalysis.cpp | 10 +++++-----
16 .../PrivateMemory/PrivateMemoryResolution.cpp | 4 ----
17 IGC/DebugInfo/DebugInfoUtils.hpp | 4 ----
18 IGC/DebugInfo/DwarfDebug.cpp | 8 --------
19 5 files changed, 5 insertions(+), 25 deletions(-)
20
21diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
22index 12f42be8..c4f9d1ea 100644
23--- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
24+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
25@@ -1576,11 +1576,7 @@ void SPIRVToLLVMDbgTran::transDbgInfo(SPIRVValue *SV, Value *V) {
26 Line->getColumn(), scope, iat);
27
28 if(scope && !isa<DIFile>(scope))
29-#if LLVM_VERSION_MAJOR >= 12
30 I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(),
31-#else
32- I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(),
33-#endif
34 scope, iat));
35 }
36 }
37diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
38index e9c07b34..b6b779da 100644
39--- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
40+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
41@@ -23,8 +23,7 @@ IN THE SOFTWARE.
42 ============================= end_copyright_notice ===========================*/
43
44 #include "llvm/Config/llvm-config.h"
45-#include "llvmWrapper/IR/DerivedTypes.h"
46-#include "llvmWrapper/Analysis/TargetLibraryInfo.h"
47+#include <llvm/Analysis/TargetLibraryInfo.h>
48 #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h"
49 #include "Compiler/CodeGenPublic.h"
50 #include "Compiler/IGCPassSupport.h"
51@@ -180,11 +179,12 @@ namespace {
52 bool doInitialization(Module& M) override {
53 if(M.size() > 0)
54 {
55+ Result.reset(new AddressSpaceAAResult(
56+ getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
57 #if LLVM_VERSION_MAJOR >= 10
58- Function &F = *M.begin();
59+ *M.begin()
60 #endif
61- Result.reset(new AddressSpaceAAResult(
62- getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(),
63+ ),
64 *getAnalysis<CodeGenContextWrapper>().getCodeGenContext()));
65 }
66 return false;
67diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
68index 07f85f4c..98ea616f 100644
69--- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
70+++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
71@@ -816,11 +816,7 @@ bool PrivateMemoryResolution::resolveAllocaInstructions(bool privateOnStack)
72 // Construct an empty DebugLoc.
73 IF_DEBUG_INFO(DebugLoc entryDebugLoc);
74 // Assign with the function location if available.
75-#if LLVM_VERSION_MAJOR >= 12
76 IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DILocation::get(subprogram->getContext(), subprogram->getLine(), 0, subprogram););
77-#else
78- IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DebugLoc::get(subprogram->getLine(), 0, subprogram););
79-#endif
80 IF_DEBUG_INFO(entryBuilder.SetCurrentDebugLocation(entryDebugLoc));
81
82 if (privateOnStack)
83diff --git a/IGC/DebugInfo/DebugInfoUtils.hpp b/IGC/DebugInfo/DebugInfoUtils.hpp
84index b77a550d..88b30a75 100644
85--- a/IGC/DebugInfo/DebugInfoUtils.hpp
86+++ b/IGC/DebugInfo/DebugInfoUtils.hpp
87@@ -108,11 +108,7 @@ namespace IGC
88 IGCLLVM::DIBuilder Builder(M);
89 llvm::DIGlobalVariable* GV = GVs[j]->getVariable();
90 llvm::DIScope* scopeToUse = GV->getScope();
91-#if LLVM_VERSION_MAJOR >= 12
92 llvm::DILocation* locToUse = llvm::DILocation::get(scopeToUse->getContext(), GV->getLine(), 0, scopeToUse, loc);
93-#else
94- llvm::DILocation* locToUse = llvm::DebugLoc::get(GV->getLine(), 0, scopeToUse, loc);
95-#endif
96 if (llvm::isa<llvm::DICompileUnit>(GV->getScope()))
97 {
98 // Function has no DebugLoc so it is either internal
99diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp
100index bd9f17b7..3d9f0835 100644
101--- a/IGC/DebugInfo/DwarfDebug.cpp
102+++ b/IGC/DebugInfo/DwarfDebug.cpp
103@@ -2102,17 +2102,9 @@ static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext& Ctx)
104 // Check for number of operands since the compatibility is cheap here.
105 if (SP->getNumOperands() > 19)
106 {
107-#if LLVM_VERSION_MAJOR >= 12
108 return DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP);
109-#else
110- return DebugLoc::get(SP->getScopeLine(), 0, SP);
111-#endif
112 }
113-#if LLVM_VERSION_MAJOR >= 12
114 return DILocation::get(SP->getContext(), SP->getLine(), 0, SP);
115-#else
116- return DebugLoc::get(SP->getLine(), 0, SP);
117-#endif
118 }
119
120 return DebugLoc();
121--
1222.17.1
123
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0004-find-external-llvm-tblgen.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0004-find-external-llvm-tblgen.patch
new file mode 100644
index 00000000..79f79976
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0004-find-external-llvm-tblgen.patch
@@ -0,0 +1,30 @@
1From c9fe51ec555fadd098cfc98804ce91b1cf3029d4 Mon Sep 17 00:00:00 2001
2From: Dongwon Kim <dongwon.kim@intel.com>
3Date: Thu, 19 Aug 2021 08:28:03 -0700
4Subject: [PATCH 4/5] find external llvm-tblgen
5
6Upstream-Status: Pending
7Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
8---
9 IGC/cmake/igc_llvm.cmake | 5 ++++-
10 1 file changed, 4 insertions(+), 1 deletion(-)
11
12diff --git a/IGC/cmake/igc_llvm.cmake b/IGC/cmake/igc_llvm.cmake
13index 541793f21..bc82922b1 100644
14--- a/IGC/cmake/igc_llvm.cmake
15+++ b/IGC/cmake/igc_llvm.cmake
16@@ -24,7 +24,10 @@ set(CMAKE_MODULE_PATH
17 ${CMAKE_MODULE_PATH}
18 )
19
20-set(LLVM_TABLEGEN_EXE "llvm-tblgen")
21+find_program(LLVM_TABLEGEN_EXE "llvm-tblgen")
22+if(LLVM_TABLEGEN_EXE-NOTFOUND)
23+ message(FATAL_ERROR "[VC] llvm-tblgen is not found")
24+endif()
25
26 include(AddLLVM)
27 include(TableGen)
28--
292.20.1
30
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-Fix-build-with-LLVM-12.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0005-Temporary-LLVM-12-compatiblity-fix.patch
index 1d2c5767..000595a9 100644
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-Fix-build-with-LLVM-12.patch
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0005-Temporary-LLVM-12-compatiblity-fix.patch
@@ -1,126 +1,123 @@
1From 869cdb784aa062bd08bd26465bf0b5651e8f112e Mon Sep 17 00:00:00 2001 1From 2207600aa9ddf8be1796bcc4667bc0a3b60aef03 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu> 2From: Dongwon Kim <dongwon.kim@intel.com>
3Date: Thu, 25 Feb 2021 10:39:27 +0100 3Date: Thu, 19 Aug 2021 20:09:23 -0700
4Subject: [PATCH 1/3] Fix build with LLVM 12 4Subject: [PATCH 5/5] Temporary LLVM 12 compatiblity fix
5MIME-Version: 1.0 5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8 6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit 7Content-Transfer-Encoding: 8bit
8 8
9Upstream-Status: Pending 9Upstream-Status: Submitted
10 10
11Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> 11Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
12Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com> 12Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
13Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
13--- 14---
14 .../LegalizeFunctionSignatures.cpp | 2 +- 15 .../LegalizeFunctionSignatures.cpp | 2 +-
15 IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 26 +++++++++----- 16 IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 22 +++++-----
16 IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 6 +++- 17 IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 4 +-
17 IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | 4 +++ 18 IGC/Compiler/CISACodeGen/AdvMemOpt.cpp | 3 +-
18 IGC/Compiler/CISACodeGen/CShader.cpp | 14 ++++---- 19 IGC/Compiler/CISACodeGen/CShader.cpp | 14 +++----
19 .../CISACodeGen/ConstantCoalescing.cpp | 14 ++++---- 20 .../CISACodeGen/ConstantCoalescing.cpp | 14 +++----
20 IGC/Compiler/CISACodeGen/DeSSA.cpp | 3 +- 21 IGC/Compiler/CISACodeGen/DeSSA.cpp | 5 ++-
21 IGC/Compiler/CISACodeGen/EmitVISAPass.cpp | 35 +++++++++--------- 22 IGC/Compiler/CISACodeGen/EmitVISAPass.cpp | 42 +++++++++----------
22 IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp | 4 +-- 23 IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp | 4 +-
23 IGC/Compiler/CISACodeGen/GenIRLowering.cpp | 4 +-- 24 IGC/Compiler/CISACodeGen/GenIRLowering.cpp | 4 +-
24 .../CISACodeGen/GenSimplification.cpp | 5 +-- 25 .../CISACodeGen/GenSimplification.cpp | 5 ++-
25 .../CISACodeGen/GeometryShaderLowering.cpp | 3 +- 26 .../CISACodeGen/GeometryShaderLowering.cpp | 3 +-
26 IGC/Compiler/CISACodeGen/LdShrink.cpp | 10 ++++-- 27 IGC/Compiler/CISACodeGen/LdShrink.cpp | 10 +++--
27 .../CISACodeGen/LowerGEPForPrivMem.cpp | 8 ++--- 28 .../CISACodeGen/LowerGEPForPrivMem.cpp | 8 ++--
28 IGC/Compiler/CISACodeGen/MemOpt.cpp | 8 ++--- 29 IGC/Compiler/CISACodeGen/MemOpt.cpp | 8 ++--
29 IGC/Compiler/CISACodeGen/MemOpt2.cpp | 5 +-- 30 IGC/Compiler/CISACodeGen/MemOpt2.cpp | 5 ++-
30 .../CISACodeGen/OpenCLKernelCodeGen.cpp | 2 +- 31 .../CISACodeGen/OpenCLKernelCodeGen.cpp | 2 +-
31 IGC/Compiler/CISACodeGen/PatternMatchPass.cpp | 4 +-- 32 IGC/Compiler/CISACodeGen/PatternMatchPass.cpp | 6 +--
32 IGC/Compiler/CISACodeGen/PushAnalysis.cpp | 4 +-- 33 IGC/Compiler/CISACodeGen/PushAnalysis.cpp | 4 +-
33 .../CISACodeGen/RegisterEstimator.cpp | 3 +- 34 .../CISACodeGen/RegisterEstimator.cpp | 3 +-
34 .../CISACodeGen/RegisterPressureEstimate.hpp | 3 +- 35 .../CISACodeGen/RegisterPressureEstimate.hpp | 3 +-
35 IGC/Compiler/CISACodeGen/SLMConstProp.cpp | 3 +- 36 IGC/Compiler/CISACodeGen/SLMConstProp.cpp | 3 +-
36 .../CISACodeGen/ScalarizerCodeGen.cpp | 4 +-- 37 .../CISACodeGen/ScalarizerCodeGen.cpp | 4 +-
37 IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp | 4 +++ 38 IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp | 4 ++
38 .../CISACodeGen/Simd32Profitability.cpp | 11 ++++-- 39 .../CISACodeGen/Simd32Profitability.cpp | 10 +++--
39 IGC/Compiler/CISACodeGen/SimplifyConstant.cpp | 12 +++---- 40 IGC/Compiler/CISACodeGen/SimplifyConstant.cpp | 12 +++---
40 IGC/Compiler/CISACodeGen/TypeDemote.cpp | 3 +- 41 IGC/Compiler/CISACodeGen/TypeDemote.cpp | 3 +-
41 .../CISACodeGen/VariableReuseAnalysis.cpp | 5 +-- 42 .../CISACodeGen/VariableReuseAnalysis.cpp | 5 ++-
42 .../CISACodeGen/VariableReuseAnalysis.hpp | 3 +- 43 .../CISACodeGen/VariableReuseAnalysis.hpp | 3 +-
43 IGC/Compiler/CISACodeGen/VectorPreProcess.cpp | 24 ++++++------- 44 IGC/Compiler/CISACodeGen/VectorPreProcess.cpp | 24 +++++------
44 IGC/Compiler/CISACodeGen/VectorProcess.cpp | 4 +-- 45 IGC/Compiler/CISACodeGen/VectorProcess.cpp | 4 +-
45 IGC/Compiler/CISACodeGen/helper.cpp | 10 +++--- 46 IGC/Compiler/CISACodeGen/helper.cpp | 10 ++---
46 IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | 15 ++++++-- 47 IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp | 7 ++--
47 IGC/Compiler/CustomSafeOptPass.cpp | 26 +++++++------- 48 IGC/Compiler/CustomSafeOptPass.cpp | 26 ++++++------
48 IGC/Compiler/DebugInfo/ScalarVISAModule.cpp | 3 +- 49 IGC/Compiler/DebugInfo/ScalarVISAModule.cpp | 3 +-
49 IGC/Compiler/GenTTI.cpp | 8 ++++- 50 IGC/Compiler/GenTTI.cpp | 3 +-
50 IGC/Compiler/GenUpdateCB.cpp | 3 +- 51 IGC/Compiler/GenUpdateCB.cpp | 3 +-
51 IGC/Compiler/HandleFRemInstructions.cpp | 3 +- 52 IGC/Compiler/HandleFRemInstructions.cpp | 3 +-
52 IGC/Compiler/HandleLoadStoreInstructions.cpp | 4 +-- 53 IGC/Compiler/HandleLoadStoreInstructions.cpp | 4 +-
53 IGC/Compiler/LegalizationPass.cpp | 28 +++++++-------- 54 IGC/Compiler/LegalizationPass.cpp | 28 ++++++-------
54 IGC/Compiler/Legalizer/InstPromoter.cpp | 11 ++++-- 55 IGC/Compiler/Legalizer/InstPromoter.cpp | 2 +-
55 IGC/Compiler/Legalizer/InstScalarizer.cpp | 6 ++-- 56 IGC/Compiler/Legalizer/InstScalarizer.cpp | 6 +--
56 .../Legalizer/PeepholeTypeLegalizer.cpp | 6 ++-- 57 .../Legalizer/PeepholeTypeLegalizer.cpp | 6 +--
57 IGC/Compiler/Legalizer/TypeLegalizer.cpp | 3 +- 58 IGC/Compiler/Legalizer/TypeLegalizer.cpp | 3 +-
58 IGC/Compiler/Legalizer/TypeLegalizer.h | 3 +- 59 IGC/Compiler/Legalizer/TypeLegalizer.h | 3 +-
59 IGC/Compiler/LowPrecisionOptPass.cpp | 2 +- 60 IGC/Compiler/LowPrecisionOptPass.cpp | 2 +-
60 .../AddressSpaceAliasAnalysis.cpp | 9 ++--- 61 .../AddressSpaceAliasAnalysis.cpp | 1 +
61 .../AggregateArguments/AggregateArguments.cpp | 3 +- 62 .../AggregateArguments/AggregateArguments.cpp | 3 +-
62 .../CorrectlyRoundedDivSqrt.cpp | 3 +- 63 .../CorrectlyRoundedDivSqrt.cpp | 3 +-
63 .../DeviceEnqueueFuncs/TransformBlocks.cpp | 6 +++- 64 .../DeviceEnqueueFuncs/TransformBlocks.cpp | 4 +-
64 .../Optimizer/OpenCLPasses/KernelArgs.cpp | 3 +- 65 .../Optimizer/OpenCLPasses/KernelArgs.cpp | 3 +-
65 .../OpenCLPrintf/OpenCLPrintfResolution.cpp | 4 +-- 66 .../OpenCLPrintf/OpenCLPrintfResolution.cpp | 4 +-
66 .../PrivateMemory/PrivateMemoryResolution.cpp | 11 ++++-- 67 .../PrivateMemory/PrivateMemoryResolution.cpp | 6 +--
67 .../ReplaceUnsupportedIntrinsics.cpp | 4 +-- 68 .../ReplaceUnsupportedIntrinsics.cpp | 4 +-
68 .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp | 4 +++ 69 .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp | 2 +-
69 .../Optimizer/PreCompiledFuncImport.cpp | 4 +-- 70 .../Optimizer/PreCompiledFuncImport.cpp | 4 +-
70 IGC/Compiler/Optimizer/Scalarizer.cpp | 36 +++++++++---------- 71 IGC/Compiler/Optimizer/Scalarizer.cpp | 32 +++++++-------
71 IGC/Compiler/Optimizer/ValueTracker.cpp | 2 +- 72 IGC/Compiler/Optimizer/ValueTracker.cpp | 2 +-
72 IGC/Compiler/VerificationPass.cpp | 2 +- 73 IGC/Compiler/VerificationPass.cpp | 2 +-
73 IGC/DebugInfo/DebugInfoUtils.hpp | 4 +++ 74 IGC/DebugInfo/DebugInfoUtils.hpp | 2 +-
74 IGC/DebugInfo/DwarfDebug.cpp | 8 +++++ 75 IGC/DebugInfo/DwarfDebug.cpp | 4 +-
75 IGC/GenISAIntrinsics/GenIntrinsics.cpp | 6 ++-- 76 IGC/GenISAIntrinsics/GenIntrinsics.cpp | 6 +--
76 .../BuiltinsFrontendDefinitions.hpp | 2 +- 77 .../BuiltinsFrontendDefinitions.hpp | 2 +-
77 .../include/llvmWrapper/Support/TypeSize.h | 8 ++++- 78 .../include/llvmWrapper/IR/DerivedTypes.h | 10 +++++
78 .../include/llvmWrapper/Transforms/Scalar.h | 4 +-- 79 .../include/llvmWrapper/Support/TypeSize.h | 6 ++-
79 IGC/common/igc_resourceDimTypes.h | 5 +++ 80 .../include/llvmWrapper/Transforms/Scalar.h | 4 +-
80 66 files changed, 303 insertions(+), 196 deletions(-) 81 .../llvmWrapper/Transforms/Utils/LoopUtils.h | 8 ++++
82 IGC/common/igc_resourceDimTypes.h | 6 ++-
83 68 files changed, 263 insertions(+), 207 deletions(-)
81 84
82diff --git a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp 85diff --git a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
83index 4046b4a6..8ed36089 100644 86index d06c26de4..ee43be301 100644
84--- a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp 87--- a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
85+++ b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp 88+++ b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
86@@ -156,7 +156,7 @@ inline Type* LegalizedIntVectorType(Module& M, const Type* const oldTy) 89@@ -133,7 +133,7 @@ inline Type* LegalizedIntVectorType(Module& M, Type* ty)
87 else if (size <= 64) newSize = 64;
88 else IGC_ASSERT_MESSAGE(0, "Currently don't support upscaling int sizes > 64 bits");
89 90
90- return IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<VectorType>(oldTy)->getNumElements()); 91 return ty->isIntegerTy() ?
91+ return IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<IGCLLVM::FixedVectorType>(oldTy)->getNumElements()); 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());
92 } 95 }
93 96
94 void LegalizeFunctionSignatures::FixFunctionSignatures() 97 // Returns true for small structures that only contain primitive types
95diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp 98diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
96index 41d1f2ea..725a1512 100644 99index 66f31a0ce..65e672afe 100644
97--- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp 100--- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
98+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp 101+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
99@@ -1576,7 +1576,11 @@ void SPIRVToLLVMDbgTran::transDbgInfo(SPIRVValue *SV, Value *V) { 102@@ -1610,7 +1610,7 @@ void SPIRVToLLVMDbgTran::transDbgInfo(SPIRVValue *SV, Value *V) {
100 Line->getColumn(), scope, iat); 103 Line->getColumn(), scope, iat);
101 104
102 if(scope && !isa<DIFile>(scope)) 105 if(scope && !isa<DIFile>(scope))
103+#if LLVM_VERSION_MAJOR >= 12 106- I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(),
104+ I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(), 107+ I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(),
105+#else
106 I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(),
107+#endif
108 scope, iat)); 108 scope, iat));
109 } 109 }
110 } 110 }
111@@ -1925,7 +1929,11 @@ SPIRVToLLVM::transType(SPIRVType *T) { 111@@ -2063,7 +2063,7 @@ SPIRVToLLVM::transType(SPIRVType *T) {
112 auto name = isSubgroupAvcINTELTypeOpCode(OC) ? 112 auto name = isSubgroupAvcINTELTypeOpCode(OC) ?
113 OCLSubgroupINTELTypeOpCodeMap::rmap(OC) : 113 OCLSubgroupINTELTypeOpCodeMap::rmap(OC) :
114 BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC); 114 BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC);
115+#if LLVM_VERSION_MAJOR >= 12 115- auto *pST = M->getTypeByName(name);
116+ auto *pST = llvm::StructType::getTypeByName(M->getContext(), name); 116+ auto *pST = IGCLLVM::getTypeByName(M, name);
117+#else
118 auto *pST = M->getTypeByName(name);
119+#endif
120 pST = pST ? pST : StructType::create(*Context, name); 117 pST = pST ? pST : StructType::create(*Context, name);
121 118
122 return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC))); 119 return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC)));
123@@ -2403,7 +2411,7 @@ Value *SPIRVToLLVM::promoteBool(Value *pVal, BasicBlock *BB) 120@@ -2541,7 +2541,7 @@ Value *SPIRVToLLVM::promoteBool(Value *pVal, BasicBlock *BB)
124 121
125 auto *PromoType = isa<VectorType>(pVal->getType()) ? 122 auto *PromoType = isa<VectorType>(pVal->getType()) ?
126 cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt8Ty(pVal->getContext()), 123 cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt8Ty(pVal->getContext()),
@@ -129,7 +126,7 @@ index 41d1f2ea..725a1512 100644
129 Type::getInt8Ty(pVal->getContext()); 126 Type::getInt8Ty(pVal->getContext());
130 127
131 if (auto *C = dyn_cast<Constant>(pVal)) 128 if (auto *C = dyn_cast<Constant>(pVal))
132@@ -2445,7 +2453,7 @@ Value *SPIRVToLLVM::truncBool(Value *pVal, BasicBlock *BB) 129@@ -2583,7 +2583,7 @@ Value *SPIRVToLLVM::truncBool(Value *pVal, BasicBlock *BB)
133 130
134 auto *TruncType = isa<VectorType>(pVal->getType()) ? 131 auto *TruncType = isa<VectorType>(pVal->getType()) ?
135 cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(pVal->getContext()), 132 cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(pVal->getContext()),
@@ -138,7 +135,7 @@ index 41d1f2ea..725a1512 100644
138 Type::getInt1Ty(pVal->getContext()); 135 Type::getInt1Ty(pVal->getContext());
139 136
140 if (auto *C = dyn_cast<Constant>(pVal)) 137 if (auto *C = dyn_cast<Constant>(pVal))
141@@ -2491,7 +2499,7 @@ Type *SPIRVToLLVM::truncBoolType(SPIRVType *SPVType, Type *LLType) 138@@ -2629,7 +2629,7 @@ Type *SPIRVToLLVM::truncBoolType(SPIRVType *SPVType, Type *LLType)
142 139
143 return isa<VectorType>(LLType) ? 140 return isa<VectorType>(LLType) ?
144 cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(LLType->getContext()), 141 cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(LLType->getContext()),
@@ -147,7 +144,7 @@ index 41d1f2ea..725a1512 100644
147 Type::getInt1Ty(LLType->getContext()); 144 Type::getInt1Ty(LLType->getContext());
148 } 145 }
149 146
150@@ -2648,7 +2656,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F, 147@@ -2837,7 +2837,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
151 { 148 {
152 if(CV[i]->getType()->isVectorTy()) 149 if(CV[i]->getType()->isVectorTy())
153 { 150 {
@@ -156,7 +153,7 @@ index 41d1f2ea..725a1512 100644
156 { 153 {
157 Value *v = ExtractElementInst::Create( CV[i],ConstantInt::get( *Context,APInt( 32,j ) ),BCC->getName(),BB ); 154 Value *v = ExtractElementInst::Create( CV[i],ConstantInt::get( *Context,APInt( 32,j ) ),BCC->getName(),BB );
158 elm1 = CreateCompositeConstruct( elm1,v,pos++ ); 155 elm1 = CreateCompositeConstruct( elm1,v,pos++ );
159@@ -3336,7 +3344,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F, 156@@ -3508,7 +3508,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
160 auto Vector = transValue(BI->getOperand(0), F, BB); 157 auto Vector = transValue(BI->getOperand(0), F, BB);
161 auto Scalar = transValue(BI->getOperand(1), F, BB); 158 auto Scalar = transValue(BI->getOperand(1), F, BB);
162 159
@@ -165,7 +162,7 @@ index 41d1f2ea..725a1512 100644
165 auto Undef = UndefValue::get(VecType); 162 auto Undef = UndefValue::get(VecType);
166 163
167 auto ScalarVec = InsertElementInst::Create(Undef, Scalar, 164 auto ScalarVec = InsertElementInst::Create(Undef, Scalar,
168@@ -3361,7 +3369,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F, 165@@ -3533,7 +3533,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
169 a->getType()->getScalarSizeInBits() - 1); 166 a->getType()->getScalarSizeInBits() - 1);
170 auto *ShiftOp = isa<VectorType>(a->getType()) ? 167 auto *ShiftOp = isa<VectorType>(a->getType()) ?
171 ConstantVector::getSplat( 168 ConstantVector::getSplat(
@@ -174,7 +171,7 @@ index 41d1f2ea..725a1512 100644
174 ShiftAmt; 171 ShiftAmt;
175 172
176 // OCL C: 173 // OCL C:
177@@ -3705,15 +3713,15 @@ SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI, BasicBlock *BB) { 174@@ -3887,15 +3887,15 @@ SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI, BasicBlock *BB) {
178 "", 175 "",
179 BB); 176 BB);
180 } 177 }
@@ -194,22 +191,19 @@ index 41d1f2ea..725a1512 100644
194 191
195 imageCoordinateWiden = new ShuffleVectorInst( 192 imageCoordinateWiden = new ShuffleVectorInst(
196diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp 193diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
197index 57821556..91b4623c 100644 194index 73ffca030..ecb045b88 100644
198--- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp 195--- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
199+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp 196+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
200@@ -93,7 +93,11 @@ saveLLVMModule(Module *M, const std::string &OutputFile) { 197@@ -76,7 +76,7 @@ saveLLVMModule(Module *M, const std::string &OutputFile) {
201 PointerType* 198 PointerType*
202 getOrCreateOpaquePtrType(Module *M, const std::string &Name, 199 getOrCreateOpaquePtrType(Module *M, const std::string &Name,
203 unsigned AddrSpace) { 200 unsigned AddrSpace) {
204+#if LLVM_VERSION_MAJOR >= 12 201- auto OpaqueType = M->getTypeByName(Name);
205+ auto OpaqueType = llvm::StructType::getTypeByName(M->getContext(), Name); 202+ auto OpaqueType = IGCLLVM::getTypeByName(M, Name);
206+#else
207 auto OpaqueType = M->getTypeByName(Name);
208+#endif
209 if (!OpaqueType) 203 if (!OpaqueType)
210 OpaqueType = StructType::create(M->getContext(), Name); 204 OpaqueType = StructType::create(M->getContext(), Name);
211 return PointerType::get(OpaqueType, AddrSpace); 205 return PointerType::get(OpaqueType, AddrSpace);
212@@ -159,7 +163,7 @@ std::string recursive_mangle(const Type* pType) 206@@ -142,7 +142,7 @@ std::string recursive_mangle(const Type* pType)
213 return "i" + utostr(pType->getIntegerBitWidth()); 207 return "i" + utostr(pType->getIntegerBitWidth());
214 case IGCLLVM::VectorTyID: 208 case IGCLLVM::VectorTyID:
215 { 209 {
@@ -219,26 +213,31 @@ index 57821556..91b4623c 100644
219 return "v" + utostr(vecLen) + recursive_mangle(pEltType); 213 return "v" + utostr(vecLen) + recursive_mangle(pEltType);
220 } 214 }
221diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp 215diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
222index 81acc6ce..fc45a510 100644 216index 876cb0a30..9621c4d53 100644
223--- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp 217--- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
224+++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp 218+++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
225@@ -134,7 +134,11 @@ bool AdvMemOpt::runOnFunction(Function& F) { 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) {
226 for (auto I = LI->begin(), E = LI->end(); I != E; ++I) 228 for (auto I = LI->begin(), E = LI->end(); I != E; ++I)
227 for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) { 229 for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) {
228 Loop* L = *DFI; 230 Loop* L = *DFI;
229+#if LLVM_VERSION_MAJOR >= 12 231- if (L->empty())
230+ if (L->isInnermost()) 232+ if (IGCLLVM::isInnermost(L))
231+#else
232 if (L->empty())
233+#endif
234 InnermostLoops.push_back(L); 233 InnermostLoops.push_back(L);
235 } 234 }
236 235
237diff --git a/IGC/Compiler/CISACodeGen/CShader.cpp b/IGC/Compiler/CISACodeGen/CShader.cpp 236diff --git a/IGC/Compiler/CISACodeGen/CShader.cpp b/IGC/Compiler/CISACodeGen/CShader.cpp
238index e3cb8153..ebc99615 100644 237index 04b59cf00..16b77b050 100644
239--- a/IGC/Compiler/CISACodeGen/CShader.cpp 238--- a/IGC/Compiler/CISACodeGen/CShader.cpp
240+++ b/IGC/Compiler/CISACodeGen/CShader.cpp 239+++ b/IGC/Compiler/CISACodeGen/CShader.cpp
241@@ -430,7 +430,7 @@ void CShader::CreateAliasVars() 240@@ -427,7 +427,7 @@ void CShader::CreateAliasVars()
242 continue; 241 continue;
243 242
244 Type* Ty = V->getType(); 243 Type* Ty = V->getType();
@@ -247,7 +246,7 @@ index e3cb8153..ebc99615 100644
247 Type* BTy = VTy ? VTy->getElementType() : Ty; 246 Type* BTy = VTy ? VTy->getElementType() : Ty;
248 int nelts = (VTy ? (int)VTy->getNumElements() : 1); 247 int nelts = (VTy ? (int)VTy->getNumElements() : 1);
249 248
250@@ -961,7 +961,7 @@ bool CShader::InsideDivergentCF(llvm::Instruction* inst) 249@@ -1039,7 +1039,7 @@ bool CShader::InsideWorkgroupDivergentCF(const llvm::Instruction* inst) const
251 uint CShader::GetNbVectorElementAndMask(llvm::Value* val, uint32_t& mask) 250 uint CShader::GetNbVectorElementAndMask(llvm::Value* val, uint32_t& mask)
252 { 251 {
253 llvm::Type* type = val->getType(); 252 llvm::Type* type = val->getType();
@@ -256,25 +255,16 @@ index e3cb8153..ebc99615 100644
256 mask = 0; 255 mask = 0;
257 // we don't process vector bigger than 31 elements as the mask has only 32bits 256 // we don't process vector bigger than 31 elements as the mask has only 32bits
258 // If we want to support longer vectors we need to extend the mask size 257 // If we want to support longer vectors we need to extend the mask size
259@@ -1166,7 +1166,7 @@ uint32_t CShader::GetExtractMask(llvm::Value* vecVal) 258@@ -1244,7 +1244,7 @@ CShader::ExtractMaskWrapper::ExtractMaskWrapper(CShader* pS, Value* VecVal)
260 { 259 m_EM = it->second;
261 return it->second; 260 return;
262 } 261 }
263- const unsigned int numChannels = vecVal->getType()->isVectorTy() ? (unsigned)cast<VectorType>(vecVal->getType())->getNumElements() : 1; 262- VectorType* VTy = dyn_cast<VectorType>(VecVal->getType());
264+ const unsigned int numChannels = vecVal->getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(vecVal->getType())->getNumElements() : 1; 263+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(VecVal->getType());
265 IGC_ASSERT_MESSAGE(numChannels <= 32, "Mask has 32 bits maximally!"); 264 const unsigned int numChannels = VTy ? (unsigned)VTy->getNumElements() : 1;
266 return (1ULL << numChannels) - 1; 265 if (numChannels <= 32)
267 }
268@@ -1174,7 +1174,7 @@ uint32_t CShader::GetExtractMask(llvm::Value* vecVal)
269 uint16_t CShader::AdjustExtractIndex(llvm::Value* vecVal, uint16_t index)
270 {
271 uint16_t result = index;
272- if (cast<VectorType>(vecVal->getType())->getNumElements() < 32)
273+ if (cast<IGCLLVM::FixedVectorType>(vecVal->getType())->getNumElements() < 32)
274 { 266 {
275 uint32_t mask = GetExtractMask(vecVal); 267@@ -1768,7 +1768,7 @@ CVariable* CShader::GetStructVariable(llvm::Value* v, bool forceVectorInit)
276 for (uint i = 0; i < index; ++i)
277@@ -1591,7 +1591,7 @@ auto sizeToSIMDMode = [](uint32_t size)
278 268
279 CVariable* CShader::GetConstant(llvm::Constant* C, CVariable* dstVar) 269 CVariable* CShader::GetConstant(llvm::Constant* C, CVariable* dstVar)
280 { 270 {
@@ -283,7 +273,7 @@ index e3cb8153..ebc99615 100644
283 if (C && VTy) 273 if (C && VTy)
284 { // Vector constant 274 { // Vector constant
285 llvm::Type* eTy = VTy->getElementType(); 275 llvm::Type* eTy = VTy->getElementType();
286@@ -1816,7 +1816,7 @@ uint32_t CShader::GetNumElts(llvm::Type* type, bool isUniform) 276@@ -1996,7 +1996,7 @@ uint32_t CShader::GetNumElts(llvm::Type* type, bool isUniform)
287 { 277 {
288 IGC_ASSERT(type->getContainedType(0)->isIntegerTy() || type->getContainedType(0)->isFloatingPointTy()); 278 IGC_ASSERT(type->getContainedType(0)->isIntegerTy() || type->getContainedType(0)->isFloatingPointTy());
289 279
@@ -291,21 +281,30 @@ index e3cb8153..ebc99615 100644
291+ auto VT = cast<IGCLLVM::FixedVectorType>(type); 281+ auto VT = cast<IGCLLVM::FixedVectorType>(type);
292 numElts *= (uint16_t)VT->getNumElements(); 282 numElts *= (uint16_t)VT->getNumElements();
293 } 283 }
294 return numElts; 284 else if (type->isStructTy())
295@@ -2516,7 +2516,7 @@ CVariable* CShader::GetSymbol(llvm::Value* value, bool fromConstantPool) 285@@ -2709,7 +2709,7 @@ CVariable* CShader::GetSymbol(llvm::Value* value, bool fromConstantPool)
296 if (isVecType) 286 if (isVecType)
297 { 287 {
298 // Map the entire vector value to the CVar 288 // Map the entire vector value to the CVar
299- unsigned numElements = (unsigned)cast<VectorType>(value->getType())->getNumElements(); 289- unsigned numElements = (unsigned)cast<VectorType>(value->getType())->getNumElements();
300+ unsigned numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(value->getType())->getNumElements(); 290+ unsigned numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(value->getType())->getNumElements();
301 var = GetNewVariable(numElements, ISA_TYPE_UQ, (GetContext()->platform.getGRFSize() == 64) ? EALIGN_32WORD : EALIGN_HWORD, true, 1, valName); 291 var = GetNewVariable(numElements, ISA_TYPE_UQ,
302 symbolMapping.insert(std::pair<llvm::Value*, CVariable*>(value, var)); 292 (GetContext()->platform.getGRFSize() == 64) ? EALIGN_32WORD : EALIGN_HWORD,
303 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 }
304diff --git a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp 303diff --git a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
305index 1efe116f..47b7c6c0 100644 304index 43fcfc7c0..8d58414b6 100644
306--- a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp 305--- a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
307+++ b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp 306+++ b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
308@@ -224,7 +224,7 @@ static void checkInsertExtractMatch(InsertElementInst* insertInst, Value* base, 307@@ -182,7 +182,7 @@ static void checkInsertExtractMatch(InsertElementInst* insertInst, Value* base,
309 308
310 static bool canReplaceInsert(InsertElementInst* insertElt) 309 static bool canReplaceInsert(InsertElementInst* insertElt)
311 { 310 {
@@ -314,7 +313,7 @@ index 1efe116f..47b7c6c0 100644
314 ConstantInt* index = dyn_cast<ConstantInt>(insertElt->getOperand(2)); 313 ConstantInt* index = dyn_cast<ConstantInt>(insertElt->getOperand(2));
315 if (!index || index->getZExtValue() != VTy->getNumElements() - 1) 314 if (!index || index->getZExtValue() != VTy->getNumElements() - 1)
316 { 315 {
317@@ -312,7 +312,7 @@ void ConstantCoalescing::VectorizePrep(llvm::BasicBlock* bb) 316@@ -270,7 +270,7 @@ void ConstantCoalescing::VectorizePrep(llvm::BasicBlock* bb)
318 { 317 {
319 if (load->getType()->isVectorTy() && wiAns->isUniform(load)) 318 if (load->getType()->isVectorTy() && wiAns->isUniform(load))
320 { 319 {
@@ -323,7 +322,7 @@ index 1efe116f..47b7c6c0 100644
323 DenseMap<uint64_t, Instruction*> extractElementMap; 322 DenseMap<uint64_t, Instruction*> extractElementMap;
324 323
325 for (auto iter = load->user_begin(); iter != load->user_end(); iter++) 324 for (auto iter = load->user_begin(); iter != load->user_end(); iter++)
326@@ -396,7 +396,7 @@ bool ConstantCoalescing::isProfitableLoad( 325@@ -354,7 +354,7 @@ bool ConstantCoalescing::isProfitableLoad(
327 (isa<LoadInst>(I) && wiAns->isUniform(I)) ? 326 (isa<LoadInst>(I) && wiAns->isUniform(I)) ?
328 16 : 4; 327 16 : 4;
329 328
@@ -332,7 +331,7 @@ index 1efe116f..47b7c6c0 100644
332 return false; 331 return false;
333 332
334 MaxEltPlus = CheckVectorElementUses(I); 333 MaxEltPlus = CheckVectorElementUses(I);
335@@ -1787,7 +1787,7 @@ void ConstantCoalescing::AdjustChunk(BufChunk* cov_chunk, uint start_adj, uint s 334@@ -1933,7 +1933,7 @@ void ConstantCoalescing::AdjustChunk(BufChunk* cov_chunk, uint start_adj, uint s
336 WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO); 335 WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO);
337 irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode()); 336 irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode());
338 Value* vec = UndefValue::get(originalType); 337 Value* vec = UndefValue::get(originalType);
@@ -341,7 +340,7 @@ index 1efe116f..47b7c6c0 100644
341 { 340 {
342 Value* channel = irBuilder->CreateExtractElement( 341 Value* channel = irBuilder->CreateExtractElement(
343 cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj)); 342 cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj));
344@@ -1851,7 +1851,7 @@ void ConstantCoalescing::MoveExtracts(BufChunk* cov_chunk, Instruction* load, ui 343@@ -1997,7 +1997,7 @@ void ConstantCoalescing::MoveExtracts(BufChunk* cov_chunk, Instruction* load, ui
345 irBuilder->SetInsertPoint(load->getNextNode()); 344 irBuilder->SetInsertPoint(load->getNextNode());
346 Type* vecType = load->getType(); 345 Type* vecType = load->getType();
347 Value* vec = UndefValue::get(vecType); 346 Value* vec = UndefValue::get(vecType);
@@ -350,7 +349,7 @@ index 1efe116f..47b7c6c0 100644
350 { 349 {
351 Value* channel = irBuilder->CreateExtractElement( 350 Value* channel = irBuilder->CreateExtractElement(
352 cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj)); 351 cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj));
353@@ -1915,7 +1915,7 @@ void ConstantCoalescing::EnlargeChunk(BufChunk* cov_chunk, uint size_adj) 352@@ -2061,7 +2061,7 @@ void ConstantCoalescing::EnlargeChunk(BufChunk* cov_chunk, uint size_adj)
354 WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO); 353 WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO);
355 irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode()); 354 irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode());
356 Value* vec = UndefValue::get(originalType); 355 Value* vec = UndefValue::get(originalType);
@@ -359,7 +358,7 @@ index 1efe116f..47b7c6c0 100644
359 { 358 {
360 Value* channel = irBuilder->CreateExtractElement( 359 Value* channel = irBuilder->CreateExtractElement(
361 cov_chunk->chunkIO, irBuilder->getInt32(i)); 360 cov_chunk->chunkIO, irBuilder->getInt32(i));
362@@ -2343,7 +2343,7 @@ void ConstantCoalescing::ReplaceLoadWithSamplerLoad( 361@@ -2498,7 +2498,7 @@ void ConstantCoalescing::ReplaceLoadWithSamplerLoad(
363 if (dstTy->isVectorTy()) 362 if (dstTy->isVectorTy())
364 { 363 {
365 result = UndefValue::get(dstTy); 364 result = UndefValue::get(dstTy);
@@ -369,18 +368,18 @@ index 1efe116f..47b7c6c0 100644
369 Value* tmpData = ExtractFromSamplerData(cast<VectorType>(dstTy)->getElementType(), i); 368 Value* tmpData = ExtractFromSamplerData(cast<VectorType>(dstTy)->getElementType(), i);
370 result = irBuilder->CreateInsertElement(result, tmpData, irBuilder->getInt32(i)); 369 result = irBuilder->CreateInsertElement(result, tmpData, irBuilder->getInt32(i));
371diff --git a/IGC/Compiler/CISACodeGen/DeSSA.cpp b/IGC/Compiler/CISACodeGen/DeSSA.cpp 370diff --git a/IGC/Compiler/CISACodeGen/DeSSA.cpp b/IGC/Compiler/CISACodeGen/DeSSA.cpp
372index f540dc11..6fab0246 100644 371index bc06a00d2..8ac30bac2 100644
373--- a/IGC/Compiler/CISACodeGen/DeSSA.cpp 372--- a/IGC/Compiler/CISACodeGen/DeSSA.cpp
374+++ b/IGC/Compiler/CISACodeGen/DeSSA.cpp 373+++ b/IGC/Compiler/CISACodeGen/DeSSA.cpp
375@@ -83,6 +83,7 @@ IN THE SOFTWARE. 374@@ -67,6 +67,7 @@ See LICENSE.TXT for details.
376 #include "Compiler/IGCPassSupport.h"
377 #include "common/LLVMWarningsPush.hpp" 375 #include "common/LLVMWarningsPush.hpp"
376 #include "llvmWrapper/IR/Instructions.h"
378 #include <llvm/IR/InstIterator.h> 377 #include <llvm/IR/InstIterator.h>
379+#include <llvmWrapper/IR/DerivedTypes.h> 378+#include <llvmWrapper/IR/DerivedTypes.h>
379 #include <llvm/IR/InlineAsm.h>
380 #include "common/LLVMWarningsPop.hpp" 380 #include "common/LLVMWarningsPop.hpp"
381 #include <algorithm> 381 #include <algorithm>
382 #include "Probe/Assertion.h" 382@@ -1302,7 +1303,7 @@ int DeSSA::checkInsertElementAlias(
383@@ -1284,7 +1285,7 @@ int DeSSA::checkInsertElementAlias(
384 // 383 //
385 // If found, return the actual vector size; 384 // If found, return the actual vector size;
386 // otherwise, return 0. 385 // otherwise, return 0.
@@ -389,19 +388,18 @@ index f540dc11..6fab0246 100644
389 IGC_ASSERT(nullptr != VTy); 388 IGC_ASSERT(nullptr != VTy);
390 int nelts = (int)VTy->getNumElements(); 389 int nelts = (int)VTy->getNumElements();
391 AllIEIs.resize(nelts, nullptr); 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+}
392diff --git a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp 398diff --git a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
393index 3ab1cc5f..4502ef62 100644 399index dda1529eb..5541dee74 100644
394--- a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp 400--- a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
395+++ b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp 401+++ b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
396@@ -53,6 +53,7 @@ IN THE SOFTWARE. 402@@ -1265,7 +1265,7 @@ bool EmitPass::canRelocatePhiMov(
397 #include "Compiler/IGCPassSupport.h"
398 #include "common/LLVMWarningsPush.hpp"
399 #include "llvmWrapper/IR/Instructions.h"
400+#include "llvmWrapper/IR/DerivedTypes.h"
401 #include "llvm/Support/Path.h"
402 #include "llvmWrapper/IR/Intrinsics.h"
403 #include "common/LLVMWarningsPop.hpp"
404@@ -1165,7 +1166,7 @@ bool EmitPass::canRelocatePhiMov(
405 if (dst != src) 403 if (dst != src)
406 { 404 {
407 int numElt = 1; 405 int numElt = 1;
@@ -410,7 +408,7 @@ index 3ab1cc5f..4502ef62 100644
410 { 408 {
411 numElt = int_cast<int>(vTy->getNumElements()); 409 numElt = int_cast<int>(vTy->getNumElements());
412 } 410 }
413@@ -1302,7 +1303,7 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB) 411@@ -1402,7 +1402,7 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
414 phiSrcDstList.push_back(phiInfo); 412 phiSrcDstList.push_back(phiInfo);
415 413
416 int numElt = 0; 414 int numElt = 0;
@@ -419,7 +417,7 @@ index 3ab1cc5f..4502ef62 100644
419 { 417 {
420 numElt = int_cast<int>(vTy->getNumElements()); 418 numElt = int_cast<int>(vTy->getNumElements());
421 } 419 }
422@@ -5375,7 +5376,7 @@ void EmitPass::emitLegacySimdBlockWrite(llvm::Instruction* inst, llvm::Value* pt 420@@ -5606,7 +5606,7 @@ void EmitPass::emitLegacySimdBlockWrite(llvm::Instruction* inst, llvm::Value* pt
423 bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext()); 421 bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext());
424 422
425 Type* Ty = dataPtr->getType(); 423 Type* Ty = dataPtr->getType();
@@ -428,7 +426,7 @@ index 3ab1cc5f..4502ef62 100644
428 uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; 426 uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
429 427
430 uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8; 428 uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8;
431@@ -5621,7 +5622,7 @@ void EmitPass::emitLegacySimdBlockRead(llvm::Instruction* inst, llvm::Value* ptr 429@@ -5852,7 +5852,7 @@ void EmitPass::emitLegacySimdBlockRead(llvm::Instruction* inst, llvm::Value* ptr
432 bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext()); 430 bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext());
433 431
434 Type* Ty = inst->getType(); 432 Type* Ty = inst->getType();
@@ -437,7 +435,7 @@ index 3ab1cc5f..4502ef62 100644
437 uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; 435 uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
438 436
439 uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8; 437 uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8;
440@@ -5913,7 +5914,7 @@ void EmitPass::emitMediaBlockIO(const llvm::GenIntrinsicInst* inst, bool isRead) 438@@ -6144,7 +6144,7 @@ void EmitPass::emitMediaBlockIO(const llvm::GenIntrinsicInst* inst, bool isRead)
441 }; 439 };
442 440
443 uint nElts = isa<VectorType>(pDataType) ? 441 uint nElts = isa<VectorType>(pDataType) ?
@@ -446,7 +444,7 @@ index 3ab1cc5f..4502ef62 100644
446 1; 444 1;
447 445
448 // Now, do the copies. 446 // Now, do the copies.
449@@ -6003,7 +6004,7 @@ void EmitPass::emitSimdMediaBlockRead(llvm::Instruction* inst) 447@@ -6234,7 +6234,7 @@ void EmitPass::emitSimdMediaBlockRead(llvm::Instruction* inst)
450 uint32_t nbElements = 1; 448 uint32_t nbElements = 1;
451 if (inst->getType()->isVectorTy()) 449 if (inst->getType()->isVectorTy())
452 { 450 {
@@ -455,7 +453,7 @@ index 3ab1cc5f..4502ef62 100644
455 } 453 }
456 IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size"); 454 IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size");
457 455
458@@ -6247,7 +6248,7 @@ void EmitPass::emitSimdMediaBlockWrite(llvm::Instruction* inst) 456@@ -6478,7 +6478,7 @@ void EmitPass::emitSimdMediaBlockWrite(llvm::Instruction* inst)
459 uint32_t nbElements = 1; 457 uint32_t nbElements = 1;
460 if (dataPtr->getType()->isVectorTy()) 458 if (dataPtr->getType()->isVectorTy())
461 { 459 {
@@ -464,18 +462,29 @@ index 3ab1cc5f..4502ef62 100644
464 } 462 }
465 IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size"); 463 IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size");
466 464
467@@ -8993,8 +8994,8 @@ void EmitPass::emitBitCast(llvm::BitCastInst* btCst) 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)
468 { 475 {
469 Type* srcType = btCst->getOperand(0)->getType(); 476 Type* srcType = btCst->getOperand(0)->getType();
470 Type* dstType = btCst->getType(); 477 Type* dstType = btCst->getType();
471- unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<VectorType>(srcType)->getNumElements() : 1; 478- unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<VectorType>(srcType)->getNumElements() : 1;
472- unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<VectorType>(dstType)->getNumElements() : 1; 479- unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<VectorType>(dstType)->getNumElements() : 1;
480-
473+ unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(srcType)->getNumElements() : 1; 481+ unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(srcType)->getNumElements() : 1;
474+ unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(dstType)->getNumElements() : 1; 482+ unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(dstType)->getNumElements() : 1;
475 483+
476 if (srcType->isPointerTy()) 484 if (srcType->isPointerTy())
477 { 485 {
478@@ -9468,7 +9469,7 @@ void EmitPass::emitLoad3DInner(LdRawIntrinsic* inst, ResourceDescriptor& resourc 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
479 { 488 {
480 IGC_ASSERT_MESSAGE(predDefSurface != ESURFACE_STATELESS, "scratch cannot be uniform"); 489 IGC_ASSERT_MESSAGE(predDefSurface != ESURFACE_STATELESS, "scratch cannot be uniform");
481 Type* loadType = inst->getType(); 490 Type* loadType = inst->getType();
@@ -484,7 +493,7 @@ index 3ab1cc5f..4502ef62 100644
484 if (predDefSurface == ESURFACE_SLM) 493 if (predDefSurface == ESURFACE_SLM)
485 { 494 {
486 IGC_ASSERT(numElement <= 4); 495 IGC_ASSERT(numElement <= 4);
487@@ -10795,7 +10796,7 @@ void EmitPass::emitInsert(llvm::Instruction* inst) 496@@ -11278,7 +11278,7 @@ void EmitPass::emitInsert(llvm::Instruction* inst)
488 pVecVar = GetSymbol(pVec); 497 pVecVar = GetSymbol(pVec);
489 if (pVecVar != pInstVar) 498 if (pVecVar != pInstVar)
490 { 499 {
@@ -493,16 +502,16 @@ index 3ab1cc5f..4502ef62 100644
493 } 502 }
494 } 503 }
495 } 504 }
496@@ -14596,7 +14597,7 @@ bool EmitPass::isUniformStoreOCL(llvm::StoreInst* SI) 505@@ -15233,7 +15233,7 @@ bool EmitPass::isUniformStoreOCL(Value* ptr, Value* storeVal)
506 }
497 507
498 Value* storeVal = SI->getValueOperand();
499 Type* Ty = storeVal->getType(); 508 Type* Ty = storeVal->getType();
500- VectorType* VTy = dyn_cast<VectorType>(Ty); 509- VectorType* VTy = dyn_cast<VectorType>(Ty);
501+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty); 510+ IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
502 uint32_t elts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; 511 uint32_t elts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
503 Type* eltTy = VTy ? VTy->getElementType() : Ty; 512 Type* eltTy = VTy ? VTy->getElementType() : Ty;
504 513
505@@ -14626,7 +14627,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI) 514@@ -15269,7 +15269,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
506 if (srcTy->isVectorTy()) 515 if (srcTy->isVectorTy())
507 { 516 {
508 srcEltTy = cast<VectorType>(srcTy)->getElementType(); 517 srcEltTy = cast<VectorType>(srcTy)->getElementType();
@@ -511,7 +520,7 @@ index 3ab1cc5f..4502ef62 100644
511 } 520 }
512 else 521 else
513 { 522 {
514@@ -14636,7 +14637,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI) 523@@ -15279,7 +15279,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
515 if (dstTy->isVectorTy()) 524 if (dstTy->isVectorTy())
516 { 525 {
517 dstEltTy = cast<VectorType>(dstTy)->getElementType(); 526 dstEltTy = cast<VectorType>(dstTy)->getElementType();
@@ -520,7 +529,7 @@ index 3ab1cc5f..4502ef62 100644
520 } 529 }
521 else 530 else
522 { 531 {
523@@ -15215,7 +15216,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff 532@@ -15867,7 +15867,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
524 } 533 }
525 534
526 Type* Ty = inst->getType(); 535 Type* Ty = inst->getType();
@@ -529,7 +538,7 @@ index 3ab1cc5f..4502ef62 100644
529 Type* eltTy = VTy ? VTy->getElementType() : Ty; 538 Type* eltTy = VTy ? VTy->getElementType() : Ty;
530 uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy); 539 uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy);
531 IGC_ASSERT_MESSAGE((eltBytes == 1) || (eltBytes == 2) || (eltBytes == 4) || (eltBytes == 8), 540 IGC_ASSERT_MESSAGE((eltBytes == 1) || (eltBytes == 2) || (eltBytes == 4) || (eltBytes == 8),
532@@ -15667,7 +15668,7 @@ void EmitPass::emitVectorStore(StoreInst* inst, Value* offset, ConstantInt* immO 541@@ -16381,7 +16381,7 @@ void EmitPass::emitVectorStore(StoreInst* inst, Value* offset, ConstantInt* immO
533 542
534 Value* storedVal = inst->getValueOperand(); 543 Value* storedVal = inst->getValueOperand();
535 Type* Ty = storedVal->getType(); 544 Type* Ty = storedVal->getType();
@@ -538,7 +547,7 @@ index 3ab1cc5f..4502ef62 100644
538 Type* eltTy = VTy ? VTy->getElementType() : Ty; 547 Type* eltTy = VTy ? VTy->getElementType() : Ty;
539 uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy); 548 uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy);
540 549
541@@ -16471,7 +16472,7 @@ void EmitPass::emitCopyAll(CVariable* Dst, CVariable* Src, llvm::Type* Ty) 550@@ -17189,7 +17189,7 @@ void EmitPass::emitCopyAll(CVariable* Dst, CVariable* Src, llvm::Type* Ty)
542 } 551 }
543 else if (Ty->isVectorTy()) 552 else if (Ty->isVectorTy())
544 { 553 {
@@ -546,12 +555,24 @@ index 3ab1cc5f..4502ef62 100644
546+ unsigned NElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); 555+ unsigned NElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
547 emitVectorCopy(Dst, Src, NElts); 556 emitVectorCopy(Dst, Src, NElts);
548 } 557 }
549 else 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)
550diff --git a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp 571diff --git a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
551index 28248f30..767b477a 100644 572index 1c30ae361..db77b514d 100644
552--- a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp 573--- a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
553+++ b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp 574+++ b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
554@@ -1961,7 +1961,7 @@ bool InstExpander::visitExtractElement(ExtractElementInst& EEI) { 575@@ -1945,7 +1945,7 @@ bool InstExpander::visitExtractElement(ExtractElementInst& EEI) {
555 // later. 576 // later.
556 577
557 Value* V = EEI.getVectorOperand(); 578 Value* V = EEI.getVectorOperand();
@@ -560,7 +581,7 @@ index 28248f30..767b477a 100644
560 V = IRB->CreateBitCast(V, Emu->getV2Int32Ty(NumElts)); 581 V = IRB->CreateBitCast(V, Emu->getV2Int32Ty(NumElts));
561 // Re-calculate indices to Lo and Hi parts. 582 // Re-calculate indices to Lo and Hi parts.
562 Value* Idx = EEI.getIndexOperand(); 583 Value* Idx = EEI.getIndexOperand();
563@@ -1998,7 +1998,7 @@ bool InstExpander::visitInsertElement(InsertElementInst& IEI) { 584@@ -1982,7 +1982,7 @@ bool InstExpander::visitInsertElement(InsertElementInst& IEI) {
564 585
565 // Create the emulated vector. 586 // Create the emulated vector.
566 Value* NewVal = IEI.getOperand(0); 587 Value* NewVal = IEI.getOperand(0);
@@ -570,10 +591,10 @@ index 28248f30..767b477a 100644
570 // Re-calculate indices to Lo and Hi parts. 591 // Re-calculate indices to Lo and Hi parts.
571 Value* Idx = IEI.getOperand(2); 592 Value* Idx = IEI.getOperand(2);
572diff --git a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp 593diff --git a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
573index c74a2ac6..78e8a4aa 100644 594index 71e3bdf06..311964b9c 100644
574--- a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp 595--- a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
575+++ b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp 596+++ b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
576@@ -453,7 +453,7 @@ Value* GEPLowering::getSExtOrTrunc(Value* Val, Type* NewTy) const { 597@@ -437,7 +437,7 @@ Value* GEPLowering::getSExtOrTrunc(Value* Val, Type* NewTy) const {
577 598
578 IGC_ASSERT_MESSAGE(OldTy->isIntOrIntVectorTy(), "Index should be Integer or vector of Integer!"); 599 IGC_ASSERT_MESSAGE(OldTy->isIntOrIntVectorTy(), "Index should be Integer or vector of Integer!");
579 600
@@ -582,7 +603,7 @@ index c74a2ac6..78e8a4aa 100644
582 OldWidth = (unsigned)OldVecTy->getNumElements() * OldVecTy->getElementType()->getIntegerBitWidth(); 603 OldWidth = (unsigned)OldVecTy->getNumElements() * OldVecTy->getElementType()->getIntegerBitWidth();
583 NewWidth = (unsigned)OldVecTy->getNumElements() * NewTy->getIntegerBitWidth(); 604 NewWidth = (unsigned)OldVecTy->getNumElements() * NewTy->getIntegerBitWidth();
584 } 605 }
585@@ -805,7 +805,7 @@ bool GEPLowering::lowerGetElementPtrInst(GetElementPtrInst* GEP) const 606@@ -789,7 +789,7 @@ bool GEPLowering::lowerGetElementPtrInst(GetElementPtrInst* GEP) const
586 } 607 }
587 else 608 else
588 { 609 {
@@ -592,10 +613,10 @@ index c74a2ac6..78e8a4aa 100644
592 for (uint32_t j = 0; j < (uint32_t)NewIdxVT->getNumElements(); j++) { 613 for (uint32_t j = 0; j < (uint32_t)NewIdxVT->getNumElements(); j++) {
593 result = Builder->CreateInsertElement(result, PointerValue, Builder->getInt32(j)); 614 result = Builder->CreateInsertElement(result, PointerValue, Builder->getInt32(j));
594diff --git a/IGC/Compiler/CISACodeGen/GenSimplification.cpp b/IGC/Compiler/CISACodeGen/GenSimplification.cpp 615diff --git a/IGC/Compiler/CISACodeGen/GenSimplification.cpp b/IGC/Compiler/CISACodeGen/GenSimplification.cpp
595index 8c38f229..f432061e 100644 616index 23ab58538..f97482b6c 100644
596--- a/IGC/Compiler/CISACodeGen/GenSimplification.cpp 617--- a/IGC/Compiler/CISACodeGen/GenSimplification.cpp
597+++ b/IGC/Compiler/CISACodeGen/GenSimplification.cpp 618+++ b/IGC/Compiler/CISACodeGen/GenSimplification.cpp
598@@ -35,6 +35,7 @@ IN THE SOFTWARE. 619@@ -19,6 +19,7 @@ SPDX-License-Identifier: MIT
599 #include <llvm/IR/InstVisitor.h> 620 #include <llvm/IR/InstVisitor.h>
600 #include <llvm/IR/Instruction.h> 621 #include <llvm/IR/Instruction.h>
601 #include <llvm/Support/raw_ostream.h> 622 #include <llvm/Support/raw_ostream.h>
@@ -603,7 +624,7 @@ index 8c38f229..f432061e 100644
603 #include "common/LLVMWarningsPop.hpp" 624 #include "common/LLVMWarningsPop.hpp"
604 #include "Probe/Assertion.h" 625 #include "Probe/Assertion.h"
605 626
606@@ -164,7 +165,7 @@ bool GenSimplification::simplifyVectorPHINodeCase2(PHINode& PN) const { 627@@ -148,7 +149,7 @@ bool GenSimplification::simplifyVectorPHINodeCase2(PHINode& PN) const {
607 628
608 Type* Ty = PN.getType(); 629 Type* Ty = PN.getType();
609 Type* EltTy = Ty->getScalarType(); 630 Type* EltTy = Ty->getScalarType();
@@ -612,7 +633,7 @@ index 8c38f229..f432061e 100644
612 633
613 SmallVector<Value*, 8> Lanes; 634 SmallVector<Value*, 8> Lanes;
614 SmallVector<SmallVector<Value*, 8>, 4> Values; 635 SmallVector<SmallVector<Value*, 8>, 4> Values;
615@@ -238,7 +239,7 @@ void GenSimplification::visitPHINode(PHINode& PN) { 636@@ -222,7 +223,7 @@ void GenSimplification::visitPHINode(PHINode& PN) {
616 void GenSimplification::visitExtractElement(ExtractElementInst& EEI) { 637 void GenSimplification::visitExtractElement(ExtractElementInst& EEI) {
617 // Skip non-2-element vector. 638 // Skip non-2-element vector.
618 Value* Vec = EEI.getVectorOperand(); 639 Value* Vec = EEI.getVectorOperand();
@@ -622,10 +643,10 @@ index 8c38f229..f432061e 100644
622 return; 643 return;
623 644
624diff --git a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp 645diff --git a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
625index e00e8469..a60b9892 100644 646index 20638a0fe..6982ed252 100644
626--- a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp 647--- a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
627+++ b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp 648+++ b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
628@@ -33,6 +33,7 @@ IN THE SOFTWARE. 649@@ -17,6 +17,7 @@ SPDX-License-Identifier: MIT
629 #include <llvm/IR/PassManager.h> 650 #include <llvm/IR/PassManager.h>
630 #include <llvm/IR/IRBuilder.h> 651 #include <llvm/IR/IRBuilder.h>
631 #include <llvm/IR/Verifier.h> 652 #include <llvm/IR/Verifier.h>
@@ -633,7 +654,7 @@ index e00e8469..a60b9892 100644
633 #include "common/LLVMWarningsPop.hpp" 654 #include "common/LLVMWarningsPop.hpp"
634 #include "Compiler/InitializePasses.h" 655 #include "Compiler/InitializePasses.h"
635 #include "Probe/Assertion.h" 656 #include "Probe/Assertion.h"
636@@ -507,7 +508,7 @@ void GeometryShaderLowering::AddURBRead( 657@@ -444,7 +445,7 @@ void GeometryShaderLowering::AddURBRead(
637 { 658 {
638 Value* vec = UndefValue::get(inst->getType()); 659 Value* vec = UndefValue::get(inst->getType());
639 IRBuilder<> builder(inst); 660 IRBuilder<> builder(inst);
@@ -643,10 +664,10 @@ index e00e8469..a60b9892 100644
643 Value* vecElement = builder.CreateExtractElement(urbRead, builder.getInt32(i)); 664 Value* vecElement = builder.CreateExtractElement(urbRead, builder.getInt32(i));
644 vec = builder.CreateInsertElement(vec, vecElement, builder.getInt32(i)); 665 vec = builder.CreateInsertElement(vec, vecElement, builder.getInt32(i));
645diff --git a/IGC/Compiler/CISACodeGen/LdShrink.cpp b/IGC/Compiler/CISACodeGen/LdShrink.cpp 666diff --git a/IGC/Compiler/CISACodeGen/LdShrink.cpp b/IGC/Compiler/CISACodeGen/LdShrink.cpp
646index d89fbd0e..2df06df2 100644 667index 91226eeb2..f7099d6fb 100644
647--- a/IGC/Compiler/CISACodeGen/LdShrink.cpp 668--- a/IGC/Compiler/CISACodeGen/LdShrink.cpp
648+++ b/IGC/Compiler/CISACodeGen/LdShrink.cpp 669+++ b/IGC/Compiler/CISACodeGen/LdShrink.cpp
649@@ -30,6 +30,7 @@ IN THE SOFTWARE. 670@@ -14,6 +14,7 @@ SPDX-License-Identifier: MIT
650 #include <llvm/Support/Debug.h> 671 #include <llvm/Support/Debug.h>
651 #include <llvm/Support/MathExtras.h> 672 #include <llvm/Support/MathExtras.h>
652 #include <llvm/Support/raw_ostream.h> 673 #include <llvm/Support/raw_ostream.h>
@@ -654,7 +675,7 @@ index d89fbd0e..2df06df2 100644
654 #include "common/LLVMWarningsPop.hpp" 675 #include "common/LLVMWarningsPop.hpp"
655 #include "Compiler/CISACodeGen/ShaderCodeGen.hpp" 676 #include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
656 #include "Compiler/IGCPassSupport.h" 677 #include "Compiler/IGCPassSupport.h"
657@@ -79,7 +80,7 @@ IGC_INITIALIZE_PASS_BEGIN(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_AN 678@@ -63,7 +64,7 @@ IGC_INITIALIZE_PASS_BEGIN(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_AN
658 IGC_INITIALIZE_PASS_END(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_ANALYSIS) 679 IGC_INITIALIZE_PASS_END(LdShrink, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_ANALYSIS)
659 680
660 unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const { 681 unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const {
@@ -663,7 +684,7 @@ index d89fbd0e..2df06df2 100644
663 // Skip non-vector loads. 684 // Skip non-vector loads.
664 if (!VTy) 685 if (!VTy)
665 return 0; 686 return 0;
666@@ -91,9 +92,12 @@ unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const { 687@@ -75,9 +76,12 @@ unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const {
667 Type* Ty = VTy->getScalarType(); 688 Type* Ty = VTy->getScalarType();
668 // Skip non-BYTE addressable data types. So far, check integer types 689 // Skip non-BYTE addressable data types. So far, check integer types
669 // only. 690 // only.
@@ -679,10 +700,10 @@ index d89fbd0e..2df06df2 100644
679 unsigned Mask = 0; // Maxmimally 32 elements. 700 unsigned Mask = 0; // Maxmimally 32 elements.
680 701
681diff --git a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp 702diff --git a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
682index c12b20d5..5245117d 100644 703index ffd4bdc41..15d7f6d6d 100644
683--- a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp 704--- a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
684+++ b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp 705+++ b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
685@@ -634,7 +634,7 @@ void TransposeHelper::handleGEPInst( 706@@ -603,7 +603,7 @@ void TransposeHelper::handleGEPInst(
686 } 707 }
687 else 708 else
688 { 709 {
@@ -691,7 +712,7 @@ index c12b20d5..5245117d 100644
691 } 712 }
692 T = cast<VectorType>(T)->getElementType(); 713 T = cast<VectorType>(T)->getElementType();
693 } 714 }
694@@ -656,7 +656,7 @@ void TransposeHelper::handleGEPInst( 715@@ -625,7 +625,7 @@ void TransposeHelper::handleGEPInst(
695 } 716 }
696 else if (T->isVectorTy()) 717 else if (T->isVectorTy())
697 { 718 {
@@ -700,7 +721,7 @@ index c12b20d5..5245117d 100644
700 T = cast<VectorType>(T)->getElementType(); 721 T = cast<VectorType>(T)->getElementType();
701 } 722 }
702 else 723 else
703@@ -716,7 +716,7 @@ void TransposeHelperPromote::handleLoadInst( 724@@ -685,7 +685,7 @@ void TransposeHelperPromote::handleLoadInst(
704 IRBuilder<> IRB(pLoad); 725 IRBuilder<> IRB(pLoad);
705 IGC_ASSERT(nullptr != pLoad->getType()); 726 IGC_ASSERT(nullptr != pLoad->getType());
706 unsigned N = pLoad->getType()->isVectorTy() 727 unsigned N = pLoad->getType()->isVectorTy()
@@ -709,7 +730,7 @@ index c12b20d5..5245117d 100644
709 : 1; 730 : 1;
710 Value* Val = loadEltsFromVecAlloca(N, pVecAlloca, pScalarizedIdx, IRB, pLoad->getType()->getScalarType()); 731 Value* Val = loadEltsFromVecAlloca(N, pVecAlloca, pScalarizedIdx, IRB, pLoad->getType()->getScalarType());
711 pLoad->replaceAllUsesWith(Val); 732 pLoad->replaceAllUsesWith(Val);
712@@ -748,7 +748,7 @@ void TransposeHelperPromote::handleStoreInst( 733@@ -717,7 +717,7 @@ void TransposeHelperPromote::handleStoreInst(
713 // %v1 = extractelement <2 x float> %v, i32 1 734 // %v1 = extractelement <2 x float> %v, i32 1
714 // %w1 = insertelement <32 x float> %w0, float %v1, i32 %idx+1 735 // %w1 = insertelement <32 x float> %w0, float %v1, i32 %idx+1
715 // store <32 x float> %w1, <32 x float>* %ptr1 736 // store <32 x float> %w1, <32 x float>* %ptr1
@@ -719,10 +740,10 @@ index c12b20d5..5245117d 100644
719 Value* VectorIdx = ConstantInt::get(pScalarizedIdx->getType(), i); 740 Value* VectorIdx = ConstantInt::get(pScalarizedIdx->getType(), i);
720 auto Val = IRB.CreateExtractElement(pStoreVal, VectorIdx); 741 auto Val = IRB.CreateExtractElement(pStoreVal, VectorIdx);
721diff --git a/IGC/Compiler/CISACodeGen/MemOpt.cpp b/IGC/Compiler/CISACodeGen/MemOpt.cpp 742diff --git a/IGC/Compiler/CISACodeGen/MemOpt.cpp b/IGC/Compiler/CISACodeGen/MemOpt.cpp
722index e4279cca..aa788b11 100644 743index 32f24ba1c..c85eb1238 100644
723--- a/IGC/Compiler/CISACodeGen/MemOpt.cpp 744--- a/IGC/Compiler/CISACodeGen/MemOpt.cpp
724+++ b/IGC/Compiler/CISACodeGen/MemOpt.cpp 745+++ b/IGC/Compiler/CISACodeGen/MemOpt.cpp
725@@ -125,7 +125,7 @@ namespace { 746@@ -108,7 +108,7 @@ namespace {
726 MemRefListTy& MemRefs, TrivialMemRefListTy& ToOpt); 747 MemRefListTy& MemRefs, TrivialMemRefListTy& ToOpt);
727 748
728 unsigned getNumElements(Type* Ty) const { 749 unsigned getNumElements(Type* Ty) const {
@@ -731,8 +752,8 @@ index e4279cca..aa788b11 100644
731 } 752 }
732 753
733 MemoryLocation getLocation(Instruction* I) const { 754 MemoryLocation getLocation(Instruction* I) const {
734@@ -797,7 +797,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad, 755@@ -922,7 +922,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad,
735 Pos = unsigned((std::get<1>(I) - FirstOffset) / LdScalarSize); 756 Pos = unsigned((std::get<1>(I) - FirstOffset) / LdScalarSize);
736 757
737 if (Ty->isVectorTy()) { 758 if (Ty->isVectorTy()) {
738- if (Pos + cast<VectorType>(Ty)->getNumElements() > NumElts) { 759- if (Pos + cast<VectorType>(Ty)->getNumElements() > NumElts) {
@@ -740,7 +761,7 @@ index e4279cca..aa788b11 100644
740 // This implies we're trying to extract an element from our new load 761 // This implies we're trying to extract an element from our new load
741 // with an index > the size of the new load. If this happens, 762 // with an index > the size of the new load. If this happens,
742 // we'll generate correct code if it does since we don't remove the 763 // we'll generate correct code if it does since we don't remove the
743@@ -805,7 +805,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad, 764@@ -930,7 +930,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad,
744 continue; 765 continue;
745 } 766 }
746 Value* Val = UndefValue::get(Ty); 767 Value* Val = UndefValue::get(Ty);
@@ -749,7 +770,7 @@ index e4279cca..aa788b11 100644
749 Value* Ex = Builder.CreateExtractElement(NewLoad, Builder.getInt32(Pos + i)); 770 Value* Ex = Builder.CreateExtractElement(NewLoad, Builder.getInt32(Pos + i));
750 Ex = createBitOrPointerCast(Ex, ScalarTy, Builder); 771 Ex = createBitOrPointerCast(Ex, ScalarTy, Builder);
751 Val = Builder.CreateInsertElement(Val, Ex, Builder.getInt32(i)); 772 Val = Builder.CreateInsertElement(Val, Ex, Builder.getInt32(i));
752@@ -1083,7 +1083,7 @@ bool MemOpt::mergeStore(StoreInst* LeadingStore, 773@@ -1312,7 +1312,7 @@ bool MemOpt::mergeStore(StoreInst* LeadingStore,
753 IGC_ASSERT(hasSameSize(ScalarTy, LeadingStoreScalarType)); 774 IGC_ASSERT(hasSameSize(ScalarTy, LeadingStoreScalarType));
754 775
755 if (Ty->isVectorTy()) { 776 if (Ty->isVectorTy()) {
@@ -759,10 +780,10 @@ index e4279cca..aa788b11 100644
759 Ex = createBitOrPointerCast(Ex, LeadingStoreScalarType, Builder); 780 Ex = createBitOrPointerCast(Ex, LeadingStoreScalarType, Builder);
760 NewStoreVal = Builder.CreateInsertElement(NewStoreVal, Ex, 781 NewStoreVal = Builder.CreateInsertElement(NewStoreVal, Ex,
761diff --git a/IGC/Compiler/CISACodeGen/MemOpt2.cpp b/IGC/Compiler/CISACodeGen/MemOpt2.cpp 782diff --git a/IGC/Compiler/CISACodeGen/MemOpt2.cpp b/IGC/Compiler/CISACodeGen/MemOpt2.cpp
762index 4b2628d2..20115c73 100644 783index 989727107..96e1ec303 100644
763--- a/IGC/Compiler/CISACodeGen/MemOpt2.cpp 784--- a/IGC/Compiler/CISACodeGen/MemOpt2.cpp
764+++ b/IGC/Compiler/CISACodeGen/MemOpt2.cpp 785+++ b/IGC/Compiler/CISACodeGen/MemOpt2.cpp
765@@ -32,6 +32,7 @@ IN THE SOFTWARE. 786@@ -16,6 +16,7 @@ SPDX-License-Identifier: MIT
766 #include <llvm/Support/Debug.h> 787 #include <llvm/Support/Debug.h>
767 #include <llvm/Support/raw_ostream.h> 788 #include <llvm/Support/raw_ostream.h>
768 #include <llvm/Transforms/Utils/Local.h> 789 #include <llvm/Transforms/Utils/Local.h>
@@ -770,7 +791,7 @@ index 4b2628d2..20115c73 100644
770 #include "common/LLVMWarningsPop.hpp" 791 #include "common/LLVMWarningsPop.hpp"
771 #include "GenISAIntrinsics/GenIntrinsics.h" 792 #include "GenISAIntrinsics/GenIntrinsics.h"
772 793
773@@ -124,7 +125,7 @@ namespace { 794@@ -108,7 +109,7 @@ namespace {
774 if (!Ty->isSingleValueType()) 795 if (!Ty->isSingleValueType())
775 return UINT_MAX; 796 return UINT_MAX;
776 // Simply return 1 so far for scalar types. 797 // Simply return 1 so far for scalar types.
@@ -779,7 +800,7 @@ index 4b2628d2..20115c73 100644
779 if (!VecTy) 800 if (!VecTy)
780 return 1; 801 return 1;
781 // Check how that vector is used. 802 // Check how that vector is used.
782@@ -153,7 +154,7 @@ namespace { 803@@ -137,7 +138,7 @@ namespace {
783 return UINT_MAX; 804 return UINT_MAX;
784 unsigned EltByte = (Ty->getScalarSizeInBits() + 7) / 8; 805 unsigned EltByte = (Ty->getScalarSizeInBits() + 7) / 8;
785 // Simply return 1 so far for scalar types. 806 // Simply return 1 so far for scalar types.
@@ -789,10 +810,10 @@ index 4b2628d2..20115c73 100644
789 return EltByte; 810 return EltByte;
790 // Check how that vector is used. 811 // Check how that vector is used.
791diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp 812diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
792index 5baff64f..032d127a 100644 813index 01272b03b..8dc187ebf 100644
793--- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp 814--- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
794+++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp 815+++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
795@@ -410,7 +410,7 @@ namespace IGC 816@@ -409,7 +409,7 @@ namespace IGC
796 unsigned int numElements = 1; 817 unsigned int numElements = 1;
797 if (baseType->isVectorTy()) 818 if (baseType->isVectorTy())
798 { 819 {
@@ -802,10 +823,19 @@ index 5baff64f..032d127a 100644
802 } 823 }
803 824
804diff --git a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp 825diff --git a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
805index 356f1141..52396304 100644 826index cd048136a..51632e3d9 100644
806--- a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp 827--- a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
807+++ b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp 828+++ b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
808@@ -2916,8 +2916,8 @@ namespace IGC 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
809 llvm::Type* srcTy = bTInst->getOperand(0)->getType(); 839 llvm::Type* srcTy = bTInst->getOperand(0)->getType();
810 llvm::Type* dstTy = bTInst->getType(); 840 llvm::Type* dstTy = bTInst->getType();
811 841
@@ -817,10 +847,10 @@ index 356f1141..52396304 100644
817 if (srcNElts < dstNElts && srcTy->getScalarSizeInBits() < 64) 847 if (srcNElts < dstNElts && srcTy->getScalarSizeInBits() < 64)
818 { 848 {
819diff --git a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp 849diff --git a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
820index ba8c2770..8da82db0 100644 850index 4f905cc9a..0ee5ffbc0 100644
821--- a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp 851--- a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
822+++ b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp 852+++ b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
823@@ -899,7 +899,7 @@ namespace IGC 853@@ -987,7 +987,7 @@ namespace IGC
824 854
825 if (pTypeToPush->isVectorTy()) 855 if (pTypeToPush->isVectorTy())
826 { 856 {
@@ -829,7 +859,7 @@ index ba8c2770..8da82db0 100644
829 pTypeToPush = cast<VectorType>(pTypeToPush)->getElementType(); 859 pTypeToPush = cast<VectorType>(pTypeToPush)->getElementType();
830 llvm::Type* pVecTy = IGCLLVM::FixedVectorType::get(pTypeToPush, num_elms); 860 llvm::Type* pVecTy = IGCLLVM::FixedVectorType::get(pTypeToPush, num_elms);
831 pReplacedInst = llvm::UndefValue::get(pVecTy); 861 pReplacedInst = llvm::UndefValue::get(pVecTy);
832@@ -1102,7 +1102,7 @@ namespace IGC 862@@ -1178,7 +1178,7 @@ namespace IGC
833 } 863 }
834 864
835 unsigned num_elms = 865 unsigned num_elms =
@@ -839,10 +869,10 @@ index ba8c2770..8da82db0 100644
839 llvm::Value* replaceVector = nullptr; 869 llvm::Value* replaceVector = nullptr;
840 unsigned int numberChannelReplaced = 0; 870 unsigned int numberChannelReplaced = 0;
841diff --git a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp 871diff --git a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
842index 95b937e7..1c6544a4 100644 872index dee494d73..ef33489c3 100644
843--- a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp 873--- a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
844+++ b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp 874+++ b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
845@@ -41,6 +41,7 @@ IN THE SOFTWARE. 875@@ -25,6 +25,7 @@ SPDX-License-Identifier: MIT
846 #include <llvm/IR/IRBuilder.h> 876 #include <llvm/IR/IRBuilder.h>
847 #include <llvm/IR/InstIterator.h> 877 #include <llvm/IR/InstIterator.h>
848 #include <llvm/Support/MathExtras.h> 878 #include <llvm/Support/MathExtras.h>
@@ -850,7 +880,7 @@ index 95b937e7..1c6544a4 100644
850 #include "common/LLVMWarningsPop.hpp" 880 #include "common/LLVMWarningsPop.hpp"
851 #include "Probe/Assertion.h" 881 #include "Probe/Assertion.h"
852 882
853@@ -146,7 +147,7 @@ RegUse RegisterEstimator::estimateNumOfRegs(Value* V) const 883@@ -130,7 +131,7 @@ RegUse RegisterEstimator::estimateNumOfRegs(Value* V) const
854 Type* Ty = V->getType(); 884 Type* Ty = V->getType();
855 if (!Ty->isVoidTy()) 885 if (!Ty->isVoidTy())
856 { 886 {
@@ -860,10 +890,10 @@ index 95b937e7..1c6544a4 100644
860 uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; 890 uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
861 uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy); 891 uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy);
862diff --git a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp 892diff --git a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
863index beac138d..ceeafa48 100644 893index 6148817e1..80898be35 100644
864--- a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp 894--- a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
865+++ b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp 895+++ b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
866@@ -42,6 +42,7 @@ See LRCENSE.TXT for details. 896@@ -24,6 +24,7 @@ See LICENSE.TXT for details.
867 #include "llvm/Pass.h" 897 #include "llvm/Pass.h"
868 #include <llvm/IR/InstVisitor.h> 898 #include <llvm/IR/InstVisitor.h>
869 #include "llvm/Analysis/LoopInfo.h" 899 #include "llvm/Analysis/LoopInfo.h"
@@ -871,7 +901,7 @@ index beac138d..ceeafa48 100644
871 #include "common/LLVMWarningsPop.hpp" 901 #include "common/LLVMWarningsPop.hpp"
872 #include "Compiler/IGCPassSupport.h" 902 #include "Compiler/IGCPassSupport.h"
873 #include "Compiler/CISACodeGen/WIAnalysis.hpp" 903 #include "Compiler/CISACodeGen/WIAnalysis.hpp"
874@@ -240,7 +241,7 @@ namespace IGC 904@@ -222,7 +223,7 @@ namespace IGC
875 auto Ty = V->getType(); 905 auto Ty = V->getType();
876 if (Ty->isVoidTy()) 906 if (Ty->isVoidTy())
877 return 0; 907 return 0;
@@ -881,10 +911,10 @@ index beac138d..ceeafa48 100644
881 uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; 911 uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
882 uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy); 912 uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy);
883diff --git a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp 913diff --git a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
884index 962083f4..26a7b8be 100644 914index 84e481b7d..3acc4f305 100644
885--- a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp 915--- a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
886+++ b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp 916+++ b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
887@@ -39,6 +39,7 @@ IN THE SOFTWARE. 917@@ -23,6 +23,7 @@ SPDX-License-Identifier: MIT
888 #include <llvm/IR/InstIterator.h> 918 #include <llvm/IR/InstIterator.h>
889 #include <llvm/Support/Debug.h> 919 #include <llvm/Support/Debug.h>
890 #include <llvm/Support/MathExtras.h> 920 #include <llvm/Support/MathExtras.h>
@@ -892,7 +922,7 @@ index 962083f4..26a7b8be 100644
892 #include "common/LLVMWarningsPop.hpp" 922 #include "common/LLVMWarningsPop.hpp"
893 #include <vector> 923 #include <vector>
894 #include "Probe/Assertion.h" 924 #include "Probe/Assertion.h"
895@@ -629,7 +630,7 @@ bool SLMConstProp::isEqual(Constant* C0, Constant* C1) 925@@ -613,7 +614,7 @@ bool SLMConstProp::isEqual(Constant* C0, Constant* C1)
896 926
897 bool SLMConstProp::isFloatType(Type* Ty) 927 bool SLMConstProp::isFloatType(Type* Ty)
898 { 928 {
@@ -902,10 +932,10 @@ index 962083f4..26a7b8be 100644
902 if (vTy->getNumElements() > 1) 932 if (vTy->getNumElements() > 1)
903 { 933 {
904diff --git a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp 934diff --git a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
905index ce816416..32ab79c1 100644 935index 33b711b94..0651d2c34 100644
906--- a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp 936--- a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
907+++ b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp 937+++ b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
908@@ -66,7 +66,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I) 938@@ -50,7 +50,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I)
909 { 939 {
910 bool isNewTypeVector = false; 940 bool isNewTypeVector = false;
911 941
@@ -914,7 +944,7 @@ index ce816416..32ab79c1 100644
914 unsigned numElements = int_cast<unsigned>(instType->getNumElements()); 944 unsigned numElements = int_cast<unsigned>(instType->getNumElements());
915 unsigned scalarSize = instType->getScalarSizeInBits(); 945 unsigned scalarSize = instType->getScalarSizeInBits();
916 unsigned newScalarBits = numElements * scalarSize; 946 unsigned newScalarBits = numElements * scalarSize;
917@@ -111,7 +111,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I) 947@@ -95,7 +95,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I)
918 } 948 }
919 else 949 else
920 { 950 {
@@ -924,10 +954,10 @@ index ce816416..32ab79c1 100644
924 Value* ieLogicOp = UndefValue::get(newType); 954 Value* ieLogicOp = UndefValue::get(newType);
925 for (unsigned i = 0; i < newVecTypeNumEle; i++) 955 for (unsigned i = 0; i < newVecTypeNumEle; i++)
926diff --git a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp 956diff --git a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
927index d7baf806..e6fbdf23 100644 957index 14a68e0da..4f42a6770 100644
928--- a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp 958--- a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
929+++ b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp 959+++ b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
930@@ -589,12 +589,14 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi 960@@ -639,12 +639,14 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi
931 { 961 {
932 mpm.add(createPruneUnusedArgumentsPass()); 962 mpm.add(createPruneUnusedArgumentsPass());
933 963
@@ -942,7 +972,7 @@ index d7baf806..e6fbdf23 100644
942 mpm.add(createDeadCodeEliminationPass()); 972 mpm.add(createDeadCodeEliminationPass());
943 mpm.add(createCFGSimplificationPass()); 973 mpm.add(createCFGSimplificationPass());
944 } 974 }
945@@ -1475,8 +1477,10 @@ void OptimizeIR(CodeGenContext* const pContext) 975@@ -1549,8 +1551,10 @@ void OptimizeIR(CodeGenContext* const pContext)
946 // possible which potentially allows late stage code sinking of 976 // possible which potentially allows late stage code sinking of
947 // those calls by the instruction combiner. 977 // those calls by the instruction combiner.
948 mpm.add(createPostOrderFunctionAttrsLegacyPass()); 978 mpm.add(createPostOrderFunctionAttrsLegacyPass());
@@ -954,18 +984,21 @@ index d7baf806..e6fbdf23 100644
954 984
955 // enable this only when Pooled EU is not supported 985 // enable this only when Pooled EU is not supported
956diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp 986diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
957index 87ba2751..c1f4a419 100644 987index e1d1a8e60..97dbc0e74 100644
958--- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp 988--- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
959+++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp 989+++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
960@@ -30,6 +30,7 @@ IN THE SOFTWARE. 990@@ -12,8 +12,10 @@ SPDX-License-Identifier: MIT
991 #include "Compiler/CISACodeGen/Platform.hpp"
992 #include "common/LLVMWarningsPush.hpp"
961 #include <llvmWrapper/IR/DerivedTypes.h> 993 #include <llvmWrapper/IR/DerivedTypes.h>
994+#include <llvmWrapper/Transforms/Utils/LoopUtils.h>
962 #include <llvm/IR/InstIterator.h> 995 #include <llvm/IR/InstIterator.h>
963 #include <llvm/IR/Operator.h> 996 #include <llvm/IR/Operator.h>
964+#include <llvmWrapper/IR/DerivedTypes.h> 997+#include <llvmWrapper/IR/DerivedTypes.h>
965 #include "common/LLVMWarningsPop.hpp" 998 #include "common/LLVMWarningsPop.hpp"
966 #include "GenISAIntrinsics/GenIntrinsics.h" 999 #include "GenISAIntrinsics/GenIntrinsics.h"
967 #include "GenISAIntrinsics/GenIntrinsicInst.h" 1000 #include "GenISAIntrinsics/GenIntrinsicInst.h"
968@@ -577,7 +578,7 @@ static bool isPayloadHeader(Value* V) { 1001@@ -561,7 +563,7 @@ static bool isPayloadHeader(Value* V) {
969 Argument* Arg = dyn_cast<Argument>(V); 1002 Argument* Arg = dyn_cast<Argument>(V);
970 if (!Arg || !Arg->hasName()) 1003 if (!Arg || !Arg->hasName())
971 return false; 1004 return false;
@@ -974,7 +1007,7 @@ index 87ba2751..c1f4a419 100644
974 if (!VTy || VTy->getNumElements() != 8 || 1007 if (!VTy || VTy->getNumElements() != 8 ||
975 !VTy->getElementType()->isIntegerTy(32)) 1008 !VTy->getElementType()->isIntegerTy(32))
976 return false; 1009 return false;
977@@ -588,7 +589,7 @@ static bool isR0(Value* V) { 1010@@ -572,7 +574,7 @@ static bool isR0(Value* V) {
978 Argument* Arg = dyn_cast<Argument>(V); 1011 Argument* Arg = dyn_cast<Argument>(V);
979 if (!Arg || !Arg->hasName()) 1012 if (!Arg || !Arg->hasName())
980 return false; 1013 return false;
@@ -983,7 +1016,7 @@ index 87ba2751..c1f4a419 100644
983 if (!VTy || VTy->getNumElements() != 8 || 1016 if (!VTy || VTy->getNumElements() != 8 ||
984 !VTy->getElementType()->isIntegerTy(32)) 1017 !VTy->getElementType()->isIntegerTy(32))
985 return false; 1018 return false;
986@@ -599,7 +600,7 @@ static bool isEnqueuedLocalSize(Value* V) { 1019@@ -583,7 +585,7 @@ static bool isEnqueuedLocalSize(Value* V) {
987 Argument* Arg = dyn_cast<Argument>(V); 1020 Argument* Arg = dyn_cast<Argument>(V);
988 if (!Arg || !Arg->hasName()) 1021 if (!Arg || !Arg->hasName())
989 return false; 1022 return false;
@@ -992,23 +1025,20 @@ index 87ba2751..c1f4a419 100644
992 if (!VTy || VTy->getNumElements() != 3 || 1025 if (!VTy || VTy->getNumElements() != 3 ||
993 !VTy->getElementType()->isIntegerTy(32)) 1026 !VTy->getElementType()->isIntegerTy(32))
994 return false; 1027 return false;
995@@ -994,7 +995,11 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI) 1028@@ -982,7 +984,7 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI)
996 // Collect innermost simple loop. 1029 // Collect innermost simple loop.
997 for (auto I = LI->begin(), E = LI->end(); I != E; ++I) { 1030 for (auto I = LI->begin(), E = LI->end(); I != E; ++I) {
998 auto L = *I; 1031 auto L = *I;
999+#if LLVM_VERSION_MAJOR >= 12 1032- if (!L->empty())
1000+ if (!L->isInnermost()) 1033+ if (!IGCLLVM::isInnermost(L))
1001+#else
1002 if (!L->empty())
1003+#endif
1004 continue; 1034 continue;
1005 if (L->getNumBlocks() != 2) 1035 if (L->getNumBlocks() != 2)
1006 continue; 1036 continue;
1007diff --git a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp 1037diff --git a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
1008index 73f472b5..0069c4b1 100644 1038index c42e8f373..a4f758a5a 100644
1009--- a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp 1039--- a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
1010+++ b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp 1040+++ b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
1011@@ -352,7 +352,7 @@ static unsigned getLegalVectorSize(unsigned N) { 1041@@ -336,7 +336,7 @@ static unsigned getLegalVectorSize(unsigned N) {
1012 // Check vector size. We may demote the data type if all values can fit into 1042 // Check vector size. We may demote the data type if all values can fit into
1013 // smaller data type. 1043 // smaller data type.
1014 // 1044 //
@@ -1017,7 +1047,7 @@ index 73f472b5..0069c4b1 100644
1017 bool& IsSigned) { 1047 bool& IsSigned) {
1018 Constant* Init = GV->getInitializer(); 1048 Constant* Init = GV->getInitializer();
1019 IGC_ASSERT(isa<ArrayType>(Init->getType())); 1049 IGC_ASSERT(isa<ArrayType>(Init->getType()));
1020@@ -360,7 +360,7 @@ static bool checkSize(GlobalVariable* GV, VectorType*& DataType, 1050@@ -344,7 +344,7 @@ static bool checkSize(GlobalVariable* GV, VectorType*& DataType,
1021 unsigned N = (unsigned)ArrayTy->getArrayNumElements(); 1051 unsigned N = (unsigned)ArrayTy->getArrayNumElements();
1022 Type* BaseTy = ArrayTy->getArrayElementType(); 1052 Type* BaseTy = ArrayTy->getArrayElementType();
1023 unsigned VectorSize = 1; 1053 unsigned VectorSize = 1;
@@ -1026,7 +1056,7 @@ index 73f472b5..0069c4b1 100644
1026 BaseTy = VT->getElementType(); 1056 BaseTy = VT->getElementType();
1027 VectorSize = int_cast<unsigned>(VT->getNumElements()); 1057 VectorSize = int_cast<unsigned>(VT->getNumElements());
1028 N *= VectorSize; 1058 N *= VectorSize;
1029@@ -483,7 +483,7 @@ static Constant* getConstantVal(Type* VEltTy, Constant* V, bool IsSigned) { 1059@@ -467,7 +467,7 @@ static Constant* getConstantVal(Type* VEltTy, Constant* V, bool IsSigned) {
1030 return ConstantInt::get(VEltTy, IVal, IsSigned); 1060 return ConstantInt::get(VEltTy, IVal, IsSigned);
1031 } 1061 }
1032 1062
@@ -1035,7 +1065,7 @@ index 73f472b5..0069c4b1 100644
1035 Function* F) { 1065 Function* F) {
1036 // Build the constant vector from constant array. 1066 // Build the constant vector from constant array.
1037 unsigned VS = int_cast<unsigned>(AllocaType->getNumElements()); 1067 unsigned VS = int_cast<unsigned>(AllocaType->getNumElements());
1038@@ -507,7 +507,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned, 1068@@ -491,7 +491,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
1039 Constant* const Elt = CA->getAggregateElement(i); 1069 Constant* const Elt = CA->getAggregateElement(i);
1040 IGC_ASSERT_MESSAGE(nullptr != Elt, "Null AggregateElement"); 1070 IGC_ASSERT_MESSAGE(nullptr != Elt, "Null AggregateElement");
1041 if (auto EltTy = dyn_cast<VectorType>(Elt->getType())) { 1071 if (auto EltTy = dyn_cast<VectorType>(Elt->getType())) {
@@ -1044,7 +1074,7 @@ index 73f472b5..0069c4b1 100644
1044 for (unsigned j = 0; j < VectorSize; ++j) { 1074 for (unsigned j = 0; j < VectorSize; ++j) {
1045 Constant* V = Elt->getAggregateElement(j); 1075 Constant* V = Elt->getAggregateElement(j);
1046 Vals[i * VectorSize + j] = getConstantVal(VEltTy, V, IsSigned); 1076 Vals[i * VectorSize + j] = getConstantVal(VEltTy, V, IsSigned);
1047@@ -549,7 +549,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned, 1077@@ -533,7 +533,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
1048 unsigned N = 1; 1078 unsigned N = 1;
1049 Value* Offset = Index; 1079 Value* Offset = Index;
1050 if (Ty->isVectorTy()) { 1080 if (Ty->isVectorTy()) {
@@ -1053,7 +1083,7 @@ index 73f472b5..0069c4b1 100644
1053 Offset = Builder.CreateMul(Offset, ConstantInt::get(Offset->getType(), N)); 1083 Offset = Builder.CreateMul(Offset, ConstantInt::get(Offset->getType(), N));
1054 } 1084 }
1055 Value* Val = extractNElts(N, VectorData, Offset, Builder); 1085 Value* Val = extractNElts(N, VectorData, Offset, Builder);
1056@@ -684,7 +684,7 @@ bool PromoteConstant::runOnFunction(Function& F) { 1086@@ -668,7 +668,7 @@ bool PromoteConstant::runOnFunction(Function& F) {
1057 1087
1058 // If possible demote the data into smaller type. Uses of value will be 1088 // If possible demote the data into smaller type. Uses of value will be
1059 // promoted back with ZExt or SExt. 1089 // promoted back with ZExt or SExt.
@@ -1063,10 +1093,10 @@ index 73f472b5..0069c4b1 100644
1063 if (!checkSize(GV, AllocaType, IsSigned)) 1093 if (!checkSize(GV, AllocaType, IsSigned))
1064 continue; 1094 continue;
1065diff --git a/IGC/Compiler/CISACodeGen/TypeDemote.cpp b/IGC/Compiler/CISACodeGen/TypeDemote.cpp 1095diff --git a/IGC/Compiler/CISACodeGen/TypeDemote.cpp b/IGC/Compiler/CISACodeGen/TypeDemote.cpp
1066index eb7a7b64..b04a0f6e 100644 1096index cd8f2eff0..e539bd6ed 100644
1067--- a/IGC/Compiler/CISACodeGen/TypeDemote.cpp 1097--- a/IGC/Compiler/CISACodeGen/TypeDemote.cpp
1068+++ b/IGC/Compiler/CISACodeGen/TypeDemote.cpp 1098+++ b/IGC/Compiler/CISACodeGen/TypeDemote.cpp
1069@@ -32,6 +32,7 @@ IN THE SOFTWARE. 1099@@ -16,6 +16,7 @@ SPDX-License-Identifier: MIT
1070 #include <llvm/ADT/PostOrderIterator.h> 1100 #include <llvm/ADT/PostOrderIterator.h>
1071 #include <llvm/IR/IRBuilder.h> 1101 #include <llvm/IR/IRBuilder.h>
1072 #include <llvm/Pass.h> 1102 #include <llvm/Pass.h>
@@ -1074,7 +1104,7 @@ index eb7a7b64..b04a0f6e 100644
1074 #include "common/LLVMWarningsPop.hpp" 1104 #include "common/LLVMWarningsPop.hpp"
1075 #include "GenISAIntrinsics/GenIntrinsics.h" 1105 #include "GenISAIntrinsics/GenIntrinsics.h"
1076 #include "Probe/Assertion.h" 1106 #include "Probe/Assertion.h"
1077@@ -288,7 +289,7 @@ bool TypeDemote::demoteOnBasicBlock(BasicBlock* BB) const { 1107@@ -272,7 +273,7 @@ bool TypeDemote::demoteOnBasicBlock(BasicBlock* BB) const {
1078 CastInst* CI = dyn_cast<CastInst>(Index); 1108 CastInst* CI = dyn_cast<CastInst>(Index);
1079 if (CI && (CI->getOpcode() == Instruction::ZExt || 1109 if (CI && (CI->getOpcode() == Instruction::ZExt ||
1080 CI->getOpcode() == Instruction::SExt)) { 1110 CI->getOpcode() == Instruction::SExt)) {
@@ -1084,10 +1114,10 @@ index eb7a7b64..b04a0f6e 100644
1084 unsigned Bound = (N < 32) ? (1U << N) : UINT32_MAX; 1114 unsigned Bound = (N < 32) ? (1U << N) : UINT32_MAX;
1085 if (VS <= Bound) { 1115 if (VS <= Bound) {
1086diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp 1116diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
1087index 1cac7b12..12c4734e 100644 1117index 666eb62e3..8b44cfef3 100644
1088--- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp 1118--- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
1089+++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp 1119+++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
1090@@ -28,6 +28,7 @@ IN THE SOFTWARE. 1120@@ -12,6 +12,7 @@ SPDX-License-Identifier: MIT
1091 #include "Compiler/CodeGenPublic.h" 1121 #include "Compiler/CodeGenPublic.h"
1092 #include "common/LLVMWarningsPush.hpp" 1122 #include "common/LLVMWarningsPush.hpp"
1093 #include <llvm/Support/Debug.h> 1123 #include <llvm/Support/Debug.h>
@@ -1095,7 +1125,7 @@ index 1cac7b12..12c4734e 100644
1095 #include "common/LLVMWarningsPop.hpp" 1125 #include "common/LLVMWarningsPop.hpp"
1096 #include <algorithm> 1126 #include <algorithm>
1097 #include "Probe/Assertion.h" 1127 #include "Probe/Assertion.h"
1098@@ -40,13 +41,13 @@ namespace 1128@@ -24,13 +25,13 @@ namespace
1099 // If V is scalar, return 1. 1129 // If V is scalar, return 1.
1100 // if V is vector, return the number of elements. 1130 // if V is vector, return the number of elements.
1101 inline int getNumElts(Value* V) { 1131 inline int getNumElts(Value* V) {
@@ -1112,10 +1142,10 @@ index 1cac7b12..12c4734e 100644
1112 } 1142 }
1113 } 1143 }
1114diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp 1144diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
1115index 56dac17e..42081dca 100644 1145index ca523f239..d16d286fa 100644
1116--- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp 1146--- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
1117+++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp 1147+++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
1118@@ -37,6 +37,7 @@ IN THE SOFTWARE. 1148@@ -21,6 +21,7 @@ SPDX-License-Identifier: MIT
1119 #include <llvm/IR/InstIterator.h> 1149 #include <llvm/IR/InstIterator.h>
1120 #include <llvm/IR/InstVisitor.h> 1150 #include <llvm/IR/InstVisitor.h>
1121 #include "llvm/Pass.h" 1151 #include "llvm/Pass.h"
@@ -1123,7 +1153,7 @@ index 56dac17e..42081dca 100644
1123 #include "llvm/Support/raw_ostream.h" 1153 #include "llvm/Support/raw_ostream.h"
1124 #include "common/LLVMWarningsPop.hpp" 1154 #include "common/LLVMWarningsPop.hpp"
1125 #include "Compiler/CISACodeGen/RegisterEstimator.hpp" 1155 #include "Compiler/CISACodeGen/RegisterEstimator.hpp"
1126@@ -79,7 +80,7 @@ namespace IGC { 1156@@ -63,7 +64,7 @@ namespace IGC {
1127 SSubVecDesc(llvm::Value* V) 1157 SSubVecDesc(llvm::Value* V)
1128 : Aliaser(V), BaseVector(V), StartElementOffset(0) 1158 : Aliaser(V), BaseVector(V), StartElementOffset(0)
1129 { 1159 {
@@ -1133,10 +1163,10 @@ index 56dac17e..42081dca 100644
1133 } 1163 }
1134 1164
1135diff --git a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp 1165diff --git a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
1136index 4c2b0644..4cd6a2db 100644 1166index 204b2f29a..2ea975555 100644
1137--- a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp 1167--- a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
1138+++ b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp 1168+++ b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
1139@@ -500,7 +500,7 @@ void VectorPreProcess::replaceAllVectorUsesWithScalars(Instruction* VI, ValVecto 1169@@ -485,7 +485,7 @@ void VectorPreProcess::replaceAllVectorUsesWithScalars(Instruction* VI, ValVecto
1140 I = VI->getParent()->getFirstNonPHI(); 1170 I = VI->getParent()->getFirstNonPHI();
1141 } 1171 }
1142 IRBuilder<> Builder(I); 1172 IRBuilder<> Builder(I);
@@ -1145,7 +1175,7 @@ index 4c2b0644..4cd6a2db 100644
1145 Value* newVec = UndefValue::get(VTy); 1175 Value* newVec = UndefValue::get(VTy);
1146 for (uint32_t i = 0, e = int_cast<uint32_t>(VTy->getNumElements()); i < e; ++i) 1176 for (uint32_t i = 0, e = int_cast<uint32_t>(VTy->getNumElements()); i < e; ++i)
1147 { 1177 {
1148@@ -619,7 +619,7 @@ bool VectorPreProcess::splitStore( 1178@@ -626,7 +626,7 @@ bool VectorPreProcess::splitStore(
1149 { 1179 {
1150 Instruction* SI = ASI.getInst(); 1180 Instruction* SI = ASI.getInst();
1151 Value* StoredVal = ASI.getValueOperand(); 1181 Value* StoredVal = ASI.getValueOperand();
@@ -1154,7 +1184,7 @@ index 4c2b0644..4cd6a2db 100644
1154 Type* ETy = VTy->getElementType(); 1184 Type* ETy = VTy->getElementType();
1155 uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements()); 1185 uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements());
1156 1186
1157@@ -705,7 +705,7 @@ bool VectorPreProcess::splitStore( 1187@@ -712,7 +712,7 @@ bool VectorPreProcess::splitStore(
1158 { 1188 {
1159 Type* Ty1 = splitInfo[i].first; 1189 Type* Ty1 = splitInfo[i].first;
1160 uint32_t len1 = splitInfo[i].second; 1190 uint32_t len1 = splitInfo[i].second;
@@ -1163,7 +1193,7 @@ index 4c2b0644..4cd6a2db 100644
1163 for (uint32_t j = 0; j < len1; ++j) 1193 for (uint32_t j = 0; j < len1; ++j)
1164 { 1194 {
1165 Value* subVec; 1195 Value* subVec;
1166@@ -742,7 +742,7 @@ bool VectorPreProcess::splitStore( 1196@@ -749,7 +749,7 @@ bool VectorPreProcess::splitStore(
1167 { 1197 {
1168 Type* Ty1 = splitInfo[i].first; 1198 Type* Ty1 = splitInfo[i].first;
1169 uint32_t len1 = splitInfo[i].second; 1199 uint32_t len1 = splitInfo[i].second;
@@ -1172,7 +1202,7 @@ index 4c2b0644..4cd6a2db 100644
1172 for (uint32_t j = 0; j < len1; ++j) 1202 for (uint32_t j = 0; j < len1; ++j)
1173 { 1203 {
1174 uint32_t vAlign = (uint32_t)MinAlign(Align, (uint32_t)eOffset * EBytes); 1204 uint32_t vAlign = (uint32_t)MinAlign(Align, (uint32_t)eOffset * EBytes);
1175@@ -786,7 +786,7 @@ bool VectorPreProcess::splitLoad( 1205@@ -793,7 +793,7 @@ bool VectorPreProcess::splitLoad(
1176 { 1206 {
1177 Instruction* LI = ALI.getInst(); 1207 Instruction* LI = ALI.getInst();
1178 bool isLdRaw = isa<LdRawIntrinsic>(LI); 1208 bool isLdRaw = isa<LdRawIntrinsic>(LI);
@@ -1181,7 +1211,7 @@ index 4c2b0644..4cd6a2db 100644
1181 Type* ETy = VTy->getElementType(); 1211 Type* ETy = VTy->getElementType();
1182 uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements()); 1212 uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements());
1183 1213
1184@@ -848,7 +848,7 @@ bool VectorPreProcess::splitLoad( 1214@@ -855,7 +855,7 @@ bool VectorPreProcess::splitLoad(
1185 { 1215 {
1186 Type* Ty1 = splitInfo[i].first; 1216 Type* Ty1 = splitInfo[i].first;
1187 uint32_t len1 = splitInfo[i].second; 1217 uint32_t len1 = splitInfo[i].second;
@@ -1190,7 +1220,7 @@ index 4c2b0644..4cd6a2db 100644
1190 for (uint32_t j = 0; j < len1; ++j) 1220 for (uint32_t j = 0; j < len1; ++j)
1191 { 1221 {
1192 uint32_t vAlign = (uint32_t)MinAlign(Align, eOffset * EBytes); 1222 uint32_t vAlign = (uint32_t)MinAlign(Align, eOffset * EBytes);
1193@@ -916,7 +916,7 @@ bool VectorPreProcess::splitLoadStore( 1223@@ -923,7 +923,7 @@ bool VectorPreProcess::splitLoadStore(
1194 Optional<AbstractStoreInst> ASI = AbstractStoreInst::get(Inst); 1224 Optional<AbstractStoreInst> ASI = AbstractStoreInst::get(Inst);
1195 IGC_ASSERT_MESSAGE((ALI || ASI), "Inst should be either load or store"); 1225 IGC_ASSERT_MESSAGE((ALI || ASI), "Inst should be either load or store");
1196 Type* Ty = ALI ? ALI->getInst()->getType() : ASI->getValueOperand()->getType(); 1226 Type* Ty = ALI ? ALI->getInst()->getType() : ASI->getValueOperand()->getType();
@@ -1199,7 +1229,7 @@ index 4c2b0644..4cd6a2db 100644
1199 if (!VTy) 1229 if (!VTy)
1200 { 1230 {
1201 return false; 1231 return false;
1202@@ -1147,7 +1147,7 @@ void VectorPreProcess::getOrGenScalarValues( 1232@@ -1154,7 +1154,7 @@ void VectorPreProcess::getOrGenScalarValues(
1203 { 1233 {
1204 availBeforeInst = nullptr; 1234 availBeforeInst = nullptr;
1205 1235
@@ -1208,7 +1238,7 @@ index 4c2b0644..4cd6a2db 100644
1208 if (!VTy) 1238 if (!VTy)
1209 { 1239 {
1210 scalars[0] = VecVal; 1240 scalars[0] = VecVal;
1211@@ -1298,7 +1298,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst) 1241@@ -1305,7 +1305,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
1212 // 1242 //
1213 // TODO: further optimize this load into a message with channel masks 1243 // TODO: further optimize this load into a message with channel masks
1214 // for cases in which use indices are sparse like {0, 2}. 1244 // for cases in which use indices are sparse like {0, 2}.
@@ -1217,7 +1247,7 @@ index 4c2b0644..4cd6a2db 100644
1217 if (N == MaxIndex + 1) 1247 if (N == MaxIndex + 1)
1218 return Inst; 1248 return Inst;
1219 1249
1220@@ -1355,7 +1355,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst) 1250@@ -1420,7 +1420,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
1221 if (NBits < 32) 1251 if (NBits < 32)
1222 return Inst; 1252 return Inst;
1223 1253
@@ -1226,7 +1256,7 @@ index 4c2b0644..4cd6a2db 100644
1226 if (auto CV = dyn_cast<ConstantVector>(Val)) 1256 if (auto CV = dyn_cast<ConstantVector>(Val))
1227 { 1257 {
1228 unsigned MaxIndex = 0; 1258 unsigned MaxIndex = 0;
1229@@ -1524,7 +1524,7 @@ bool VectorPreProcess::runOnFunction(Function& F) 1259@@ -1589,7 +1589,7 @@ bool VectorPreProcess::runOnFunction(Function& F)
1230 for (uint32_t j = 0; j < svals.size(); ++j) 1260 for (uint32_t j = 0; j < svals.size(); ++j)
1231 { 1261 {
1232 Type* Ty1 = svals[j]->getType(); 1262 Type* Ty1 = svals[j]->getType();
@@ -1235,7 +1265,7 @@ index 4c2b0644..4cd6a2db 100644
1235 if (VTy1) { 1265 if (VTy1) {
1236 for (uint32_t k = 0; k < VTy1->getNumElements(); ++k) 1266 for (uint32_t k = 0; k < VTy1->getNumElements(); ++k)
1237 { 1267 {
1238@@ -1573,7 +1573,7 @@ bool VectorPreProcess::runOnFunction(Function& F) 1268@@ -1638,7 +1638,7 @@ bool VectorPreProcess::runOnFunction(Function& F)
1239 // If this is a 3-element vector load, remove it 1269 // If this is a 3-element vector load, remove it
1240 // from m_Vector3List as well. 1270 // from m_Vector3List as well.
1241 if (isAbstractLoadInst(tInst) && tInst->getType()->isVectorTy() && 1271 if (isAbstractLoadInst(tInst) && tInst->getType()->isVectorTy() &&
@@ -1245,10 +1275,10 @@ index 4c2b0644..4cd6a2db 100644
1245 InstWorkVector::iterator 1275 InstWorkVector::iterator
1246 tI = m_Vector3List.begin(), 1276 tI = m_Vector3List.begin(),
1247diff --git a/IGC/Compiler/CISACodeGen/VectorProcess.cpp b/IGC/Compiler/CISACodeGen/VectorProcess.cpp 1277diff --git a/IGC/Compiler/CISACodeGen/VectorProcess.cpp b/IGC/Compiler/CISACodeGen/VectorProcess.cpp
1248index 9f39cdc0..cfe45321 100644 1278index c30a07834..8046b2e65 100644
1249--- a/IGC/Compiler/CISACodeGen/VectorProcess.cpp 1279--- a/IGC/Compiler/CISACodeGen/VectorProcess.cpp
1250+++ b/IGC/Compiler/CISACodeGen/VectorProcess.cpp 1280+++ b/IGC/Compiler/CISACodeGen/VectorProcess.cpp
1251@@ -240,7 +240,7 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst) 1281@@ -224,7 +224,7 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst)
1252 IGC_ASSERT(nullptr != Ptr); 1282 IGC_ASSERT(nullptr != Ptr);
1253 IGC_ASSERT(nullptr != Ty); 1283 IGC_ASSERT(nullptr != Ty);
1254 1284
@@ -1257,7 +1287,7 @@ index 9f39cdc0..cfe45321 100644
1257 1287
1258 // Treat a scalar as 1-element vector 1288 // Treat a scalar as 1-element vector
1259 uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1; 1289 uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
1260@@ -654,7 +654,7 @@ void VectorMessage::getInfo(Type* Ty, uint32_t Align, bool useA32, 1290@@ -638,7 +638,7 @@ void VectorMessage::getInfo(Type* Ty, uint32_t Align, bool useA32,
1261 VectorType* VTy = dyn_cast<VectorType>(Ty); 1291 VectorType* VTy = dyn_cast<VectorType>(Ty);
1262 Type* eTy = VTy ? cast<VectorType>(VTy)->getElementType() : Ty; 1292 Type* eTy = VTy ? cast<VectorType>(VTy)->getElementType() : Ty;
1263 unsigned eltSize = m_emitter->GetScalarTypeSizeInRegister(eTy); 1293 unsigned eltSize = m_emitter->GetScalarTypeSizeInRegister(eTy);
@@ -1267,10 +1297,10 @@ index 9f39cdc0..cfe45321 100644
1267 const unsigned TBytes = nElts * eltSize; 1297 const unsigned TBytes = nElts * eltSize;
1268 1298
1269diff --git a/IGC/Compiler/CISACodeGen/helper.cpp b/IGC/Compiler/CISACodeGen/helper.cpp 1299diff --git a/IGC/Compiler/CISACodeGen/helper.cpp b/IGC/Compiler/CISACodeGen/helper.cpp
1270index 784affaa..e5507283 100644 1300index f3da862c6..288a69a79 100644
1271--- a/IGC/Compiler/CISACodeGen/helper.cpp 1301--- a/IGC/Compiler/CISACodeGen/helper.cpp
1272+++ b/IGC/Compiler/CISACodeGen/helper.cpp 1302+++ b/IGC/Compiler/CISACodeGen/helper.cpp
1273@@ -1634,7 +1634,7 @@ namespace IGC 1303@@ -1744,7 +1744,7 @@ namespace IGC
1274 { 1304 {
1275 instList[i] = builder.CreateExtractElement(val, static_cast<uint64_t>(0)); 1305 instList[i] = builder.CreateExtractElement(val, static_cast<uint64_t>(0));
1276 size_t iOld = i; 1306 size_t iOld = i;
@@ -1279,7 +1309,7 @@ index 784affaa..e5507283 100644
1279 { 1309 {
1280 instList.insert(instList.begin()+ iOld +j, builder.CreateExtractElement(val, j)); 1310 instList.insert(instList.begin()+ iOld +j, builder.CreateExtractElement(val, j));
1281 i++; 1311 i++;
1282@@ -1667,7 +1667,7 @@ namespace IGC 1312@@ -1777,7 +1777,7 @@ namespace IGC
1283 } 1313 }
1284 break; 1314 break;
1285 case IGCLLVM::VectorTyID: 1315 case IGCLLVM::VectorTyID:
@@ -1288,7 +1318,7 @@ index 784affaa..e5507283 100644
1288 for (unsigned i = 0; i < num; i++) 1318 for (unsigned i = 0; i < num; i++)
1289 { 1319 {
1290 ScalarizeAggregateMembers(builder, builder.CreateExtractElement(val, i), instList); 1320 ScalarizeAggregateMembers(builder, builder.CreateExtractElement(val, i), instList);
1291@@ -1707,7 +1707,7 @@ namespace IGC 1321@@ -1817,7 +1817,7 @@ namespace IGC
1292 } 1322 }
1293 break; 1323 break;
1294 case IGCLLVM::VectorTyID: 1324 case IGCLLVM::VectorTyID:
@@ -1297,7 +1327,7 @@ index 784affaa..e5507283 100644
1297 for (unsigned i = 0; i < num; i++) 1327 for (unsigned i = 0; i < num; i++)
1298 { 1328 {
1299 indices.push_back(builder.getInt32(i)); 1329 indices.push_back(builder.getInt32(i));
1300@@ -1972,8 +1972,8 @@ namespace IGC 1330@@ -2082,8 +2082,8 @@ namespace IGC
1301 return false; 1331 return false;
1302 } 1332 }
1303 1333
@@ -1309,58 +1339,30 @@ index 784affaa..e5507283 100644
1309 int s_nelts = sVTy ? (int)sVTy->getNumElements() : 1; 1339 int s_nelts = sVTy ? (int)sVTy->getNumElements() : 1;
1310 if (d_nelts != s_nelts) { 1340 if (d_nelts != s_nelts) {
1311diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp 1341diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
1312index cd7fc66e..adf992cb 100644 1342index 75089a77e..efb27ae4e 100644
1313--- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp 1343--- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
1314+++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp 1344+++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
1315@@ -153,15 +153,24 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I) 1345@@ -138,12 +138,11 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
1316 // In OGL there are uses of ldmcs other then ldms, using vec4float type. 1346 // There are uses of ldmcs other then ldms, using vector of int32 type.
1317 // Fix them to use newly created 16bit ldmcs. 1347 // Fix them to use newly created 16bit ldmcs.
1318 if (ldmcs->getType()->isVectorTy() && 1348 if (ldmcs->getType()->isVectorTy() &&
1319+#if LLVM_VERSION_MAJOR >= 12 1349- cast<VectorType>(ldmcs->getType())->getElementType() == m_builder->getInt32Ty())
1320+ ldmcs->getType()->getScalarType()->isFloatTy()) 1350+ cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getElementType()->isFloatTy())
1321+#else
1322 ldmcs->getType()->getVectorElementType()->isFloatTy())
1323+#endif
1324 { 1351 {
1325 m_builder->SetInsertPoint(ldmcs); 1352 m_builder->SetInsertPoint(ldmcs);
1326 1353-
1327+#if LLVM_VERSION_MAJOR >= 12 1354- uint32_t ldmcsNumOfElements = (uint32_t)cast<VectorType>(ldmcs->getType())->getNumElements();
1328+ uint ldmcsNumOfElements = cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements(); 1355- uint32_t newLdmcsNumOfElements = (uint32_t)cast<VectorType>(new_mcs_call->getType())->getNumElements();
1329+ uint new_mcs_callNumOfElements = cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements(); 1356+ uint32_t ldmcsNumOfElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements();
1330+#else 1357+ uint32_t newLdmcsNumOfElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements();
1331 uint ldmcsNumOfElements = ldmcs->getType()->getVectorNumElements();
1332 uint new_mcs_callNumOfElements = new_mcs_call->getType()->getVectorNumElements();
1333+#endif
1334 1358
1335 // vec of 16bit ints to vec of 32bit ints 1359 // vec of 16bit ints to vec of 32bit ints
1336- Type* new_mcs_callVecType = VectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements); 1360 Type* newLdmcsVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), newLdmcsNumOfElements);
1337+ Type* new_mcs_callVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), new_mcs_callNumOfElements);
1338 Value* ldmcsExtendedToInt32 = m_builder->CreateSExt(new_mcs_call, new_mcs_callVecType);
1339
1340 // if new ldmcs has fewer elements than ldmcs, extend vector
1341@@ -175,7 +184,7 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
1342 }
1343 auto* pMask = ConstantDataVector::get(I.getContext(), maskVals);
1344
1345- newLdmcsSizedVector = m_builder->CreateShuffleVector(ldmcsExtendedToInt32, UndefValue::get(VectorType::get(m_builder->getInt32Ty(), ldmcsNumOfElements)), pMask);
1346+ newLdmcsSizedVector = m_builder->CreateShuffleVector(ldmcsExtendedToInt32, UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), ldmcsNumOfElements)), pMask);
1347 }
1348 else
1349 {
1350@@ -183,7 +192,7 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
1351 }
1352 IGC_ASSERT(newLdmcsSizedVector);
1353
1354- Type* ldmcsFloatVecType = VectorType::get(m_builder->getFloatTy(), ldmcsNumOfElements);
1355+ Type* ldmcsFloatVecType = IGCLLVM::FixedVectorType::get(m_builder->getFloatTy(), ldmcsNumOfElements);
1356 Value* ldmcsBitcastedToFloat = m_builder->CreateBitCast(ldmcsExtendedToInt32, ldmcsFloatVecType);
1357 ldmcs->replaceAllUsesWith(ldmcsBitcastedToFloat);
1358 }
1359diff --git a/IGC/Compiler/CustomSafeOptPass.cpp b/IGC/Compiler/CustomSafeOptPass.cpp 1361diff --git a/IGC/Compiler/CustomSafeOptPass.cpp b/IGC/Compiler/CustomSafeOptPass.cpp
1360index 707bbfbe..72859a91 100644 1362index 3fe49f460..c65a466cc 100644
1361--- a/IGC/Compiler/CustomSafeOptPass.cpp 1363--- a/IGC/Compiler/CustomSafeOptPass.cpp
1362+++ b/IGC/Compiler/CustomSafeOptPass.cpp 1364+++ b/IGC/Compiler/CustomSafeOptPass.cpp
1363@@ -1372,7 +1372,7 @@ void IGC::CustomSafeOptPass::visitSampleBptr(llvm::SampleIntrinsic* sampleInst) 1365@@ -1544,7 +1544,7 @@ void IGC::CustomSafeOptPass::visitSampleBptr(llvm::SampleIntrinsic* sampleInst)
1364 bool CustomSafeOptPass::isIdentityMatrix(ExtractElementInst& I) 1366 bool CustomSafeOptPass::isIdentityMatrix(ExtractElementInst& I)
1365 { 1367 {
1366 bool found = false; 1368 bool found = false;
@@ -1369,7 +1371,7 @@ index 707bbfbe..72859a91 100644
1369 auto extractTypeVecSize = (uint32_t)extractType->getNumElements(); 1371 auto extractTypeVecSize = (uint32_t)extractType->getNumElements();
1370 if (extractTypeVecSize == 20 || 1372 if (extractTypeVecSize == 20 ||
1371 extractTypeVecSize == 16) 1373 extractTypeVecSize == 16)
1372@@ -1601,7 +1601,7 @@ void CustomSafeOptPass::visitExtractElementInst(ExtractElementInst& I) 1374@@ -1773,7 +1773,7 @@ void CustomSafeOptPass::visitExtractElementInst(ExtractElementInst& I)
1373 int elOffset = (int)(bitShift / eltSize); 1375 int elOffset = (int)(bitShift / eltSize);
1374 elOffset = rightShift ? elOffset : -elOffset; 1376 elOffset = rightShift ? elOffset : -elOffset;
1375 unsigned int newIndex = (unsigned int)((int)cstIndex->getZExtValue() + elOffset); 1377 unsigned int newIndex = (unsigned int)((int)cstIndex->getZExtValue() + elOffset);
@@ -1378,7 +1380,7 @@ index 707bbfbe..72859a91 100644
1378 { 1380 {
1379 IRBuilder<> builder(&I); 1381 IRBuilder<> builder(&I);
1380 Value* newBitCast = builder.CreateBitCast(binOp->getOperand(0), vecType); 1382 Value* newBitCast = builder.CreateBitCast(binOp->getOperand(0), vecType);
1381@@ -2001,7 +2001,7 @@ void GenSpecificPattern::createBitcastExtractInsertPattern(BinaryOperator& I, Va 1383@@ -2173,7 +2173,7 @@ void GenSpecificPattern::createBitcastExtractInsertPattern(BinaryOperator& I, Va
1382 else if (auto IEIInst = dyn_cast<InsertElementInst>(Op)) 1384 else if (auto IEIInst = dyn_cast<InsertElementInst>(Op))
1383 { 1385 {
1384 auto opType = IEIInst->getType(); 1386 auto opType = IEIInst->getType();
@@ -1387,7 +1389,7 @@ index 707bbfbe..72859a91 100644
1387 { 1389 {
1388 elem = IEIInst->getOperand(1); 1390 elem = IEIInst->getOperand(1);
1389 } 1391 }
1390@@ -2064,7 +2064,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I) 1392@@ -2236,7 +2236,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I)
1391 else if (match(&I, pattern2) && AndOp2->getType()->isIntegerTy(64)) 1393 else if (match(&I, pattern2) && AndOp2->getType()->isIntegerTy(64))
1392 { 1394 {
1393 ConstantVector* cVec = dyn_cast<ConstantVector>(VecOp); 1395 ConstantVector* cVec = dyn_cast<ConstantVector>(VecOp);
@@ -1396,7 +1398,7 @@ index 707bbfbe..72859a91 100644
1396 if (cVec && vector_type && 1398 if (cVec && vector_type &&
1397 isa<ConstantInt>(cVec->getOperand(0)) && 1399 isa<ConstantInt>(cVec->getOperand(0)) &&
1398 cast<ConstantInt>(cVec->getOperand(0))->isZero() && 1400 cast<ConstantInt>(cVec->getOperand(0))->isZero() &&
1399@@ -2210,7 +2210,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I) 1401@@ -2382,7 +2382,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I)
1400 BitCastInst* opBC = cast<BitCastInst>(op); 1402 BitCastInst* opBC = cast<BitCastInst>(op);
1401 1403
1402 auto opType = opBC->getType(); 1404 auto opType = opBC->getType();
@@ -1405,7 +1407,7 @@ index 707bbfbe..72859a91 100644
1405 return nullptr; 1407 return nullptr;
1406 1408
1407 if (opBC->getSrcTy()->isDoubleTy()) 1409 if (opBC->getSrcTy()->isDoubleTy())
1408@@ -2630,8 +2630,8 @@ void GenSpecificPattern::visitBitCastInst(BitCastInst& I) 1410@@ -2808,8 +2808,8 @@ void GenSpecificPattern::visitBitCastInst(BitCastInst& I)
1409 if (zExtInst->getOperand(0)->getType()->isIntegerTy(32) && 1411 if (zExtInst->getOperand(0)->getType()->isIntegerTy(32) &&
1410 isa<InsertElementInst>(bitCastInst->getOperand(0)) && 1412 isa<InsertElementInst>(bitCastInst->getOperand(0)) &&
1411 bitCastInst->getOperand(0)->getType()->isVectorTy() && 1413 bitCastInst->getOperand(0)->getType()->isVectorTy() &&
@@ -1416,7 +1418,7 @@ index 707bbfbe..72859a91 100644
1416 { 1418 {
1417 InsertElementInst* insertElementInst = cast<InsertElementInst>(bitCastInst->getOperand(0)); 1419 InsertElementInst* insertElementInst = cast<InsertElementInst>(bitCastInst->getOperand(0));
1418 1420
1419@@ -2731,7 +2731,7 @@ void GenSpecificPattern::visitFNeg(llvm::UnaryOperator& I) 1421@@ -2979,7 +2979,7 @@ void GenSpecificPattern::visitFNeg(llvm::UnaryOperator& I)
1420 } 1422 }
1421 else 1423 else
1422 { 1424 {
@@ -1425,7 +1427,7 @@ index 707bbfbe..72859a91 100644
1425 fsub = llvm::UndefValue::get(I.getType()); 1427 fsub = llvm::UndefValue::get(I.getType());
1426 1428
1427 for (uint32_t i = 0; i < vectorSize; ++i) 1429 for (uint32_t i = 0; i < vectorSize; ++i)
1428@@ -2845,7 +2845,7 @@ Constant* IGCConstProp::replaceShaderConstant(LoadInst* inst) 1430@@ -3056,7 +3056,7 @@ Constant* IGCConstProp::replaceShaderConstant(Instruction* inst)
1429 if (inst->getType()->isVectorTy()) 1431 if (inst->getType()->isVectorTy())
1430 { 1432 {
1431 Type* srcEltTy = cast<VectorType>(inst->getType())->getElementType(); 1433 Type* srcEltTy = cast<VectorType>(inst->getType())->getElementType();
@@ -1434,7 +1436,7 @@ index 707bbfbe..72859a91 100644
1434 uint32_t eltSize_in_bytes = (unsigned int)srcEltTy->getPrimitiveSizeInBits() / 8; 1436 uint32_t eltSize_in_bytes = (unsigned int)srcEltTy->getPrimitiveSizeInBits() / 8;
1435 IRBuilder<> builder(inst); 1437 IRBuilder<> builder(inst);
1436 Value* vectorValue = UndefValue::get(inst->getType()); 1438 Value* vectorValue = UndefValue::get(inst->getType());
1437@@ -3122,7 +3122,7 @@ Constant* IGCConstProp::ConstantFoldCmpInst(CmpInst* CI) 1439@@ -3341,7 +3341,7 @@ Constant* IGCConstProp::ConstantFoldCmpInst(CmpInst* CI)
1438 { 1440 {
1439 bool AllTrue = true, AllFalse = true; 1441 bool AllTrue = true, AllFalse = true;
1440 auto VecOpnd = cast<Constant>(EEI->getVectorOperand()); 1442 auto VecOpnd = cast<Constant>(EEI->getVectorOperand());
@@ -1443,7 +1445,7 @@ index 707bbfbe..72859a91 100644
1443 for (unsigned i = 0; i < N; ++i) 1445 for (unsigned i = 0; i < N; ++i)
1444 { 1446 {
1445 Constant* const Opnd = VecOpnd->getAggregateElement(i); 1447 Constant* const Opnd = VecOpnd->getAggregateElement(i);
1446@@ -3918,8 +3918,8 @@ namespace IGC 1448@@ -4137,8 +4137,8 @@ namespace IGC
1447 BitCastInst* BC = dyn_cast<BitCastInst>(&*BI++); 1449 BitCastInst* BC = dyn_cast<BitCastInst>(&*BI++);
1448 if (!BC) continue; 1450 if (!BC) continue;
1449 // Skip non-element-wise bitcast. 1451 // Skip non-element-wise bitcast.
@@ -1454,7 +1456,7 @@ index 707bbfbe..72859a91 100644
1454 if (!DstVTy || !SrcVTy || DstVTy->getNumElements() != SrcVTy->getNumElements()) 1456 if (!DstVTy || !SrcVTy || DstVTy->getNumElements() != SrcVTy->getNumElements())
1455 continue; 1457 continue;
1456 // Skip if it's not used only all extractelement. 1458 // Skip if it's not used only all extractelement.
1457@@ -4689,7 +4689,7 @@ void SplitIndirectEEtoSel::visitExtractElementInst(llvm::ExtractElementInst& I) 1459@@ -4928,7 +4928,7 @@ void SplitIndirectEEtoSel::visitExtractElementInst(llvm::ExtractElementInst& I)
1458 { 1460 {
1459 using namespace llvm::PatternMatch; 1461 using namespace llvm::PatternMatch;
1460 1462
@@ -1464,10 +1466,10 @@ index 707bbfbe..72859a91 100644
1464 Type* eleType = vecTy->getElementType(); 1466 Type* eleType = vecTy->getElementType();
1465 1467
1466diff --git a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp 1468diff --git a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
1467index 885ad65a..923f296e 100644 1469index d094f36e7..b66f4585a 100644
1468--- a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp 1470--- a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
1469+++ b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp 1471+++ b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
1470@@ -32,6 +32,7 @@ IN THE SOFTWARE. 1472@@ -15,6 +15,7 @@ SPDX-License-Identifier: MIT
1471 #include "DebugInfo/DebugInfoUtils.hpp" 1473 #include "DebugInfo/DebugInfoUtils.hpp"
1472 1474
1473 #include "common/LLVMWarningsPush.hpp" 1475 #include "common/LLVMWarningsPush.hpp"
@@ -1475,7 +1477,7 @@ index 885ad65a..923f296e 100644
1475 #include "llvm/IR/Function.h" 1477 #include "llvm/IR/Function.h"
1476 #include "llvm/IR/Module.h" 1478 #include "llvm/IR/Module.h"
1477 #include "common/LLVMWarningsPop.hpp" 1479 #include "common/LLVMWarningsPop.hpp"
1478@@ -581,7 +582,7 @@ ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const 1480@@ -565,7 +566,7 @@ ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const
1479 1481
1480 if (pType->isVectorTy()) 1482 if (pType->isVectorTy())
1481 { 1483 {
@@ -1485,29 +1487,31 @@ index 885ad65a..923f296e 100644
1485 else if (!pVar->IsUniform()) 1487 else if (!pVar->IsUniform())
1486 { 1488 {
1487diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp 1489diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp
1488index 34b21c73..9e4d2f26 100644 1490index d51396080..8a74ec287 100644
1489--- a/IGC/Compiler/GenTTI.cpp 1491--- a/IGC/Compiler/GenTTI.cpp
1490+++ b/IGC/Compiler/GenTTI.cpp 1492+++ b/IGC/Compiler/GenTTI.cpp
1491@@ -216,7 +216,13 @@ namespace llvm { 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 {
1492 1502
1493 // Skip non-simple loop. 1503 // Skip non-simple loop.
1494 if (L->getNumBlocks() != 1) { 1504 if (L->getNumBlocks() != 1) {
1495- if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && L->empty()) { 1505- if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && L->empty()) {
1496+ if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && 1506+ if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && IGCLLVM::isInnermost(L)) {
1497+#if LLVM_VERSION_MAJOR >= 12
1498+ L->isInnermost()
1499+#else
1500+ L->empty()
1501+#endif
1502+ ) {
1503 auto countNonPHI = [](BasicBlock* BB) { 1507 auto countNonPHI = [](BasicBlock* BB) {
1504 unsigned Total = BB->size(); 1508 unsigned Total = BB->size();
1505 unsigned PHIs = 0; 1509 unsigned PHIs = 0;
1506diff --git a/IGC/Compiler/GenUpdateCB.cpp b/IGC/Compiler/GenUpdateCB.cpp 1510diff --git a/IGC/Compiler/GenUpdateCB.cpp b/IGC/Compiler/GenUpdateCB.cpp
1507index 89b414b6..9034066c 100644 1511index f15738472..d83ced93e 100644
1508--- a/IGC/Compiler/GenUpdateCB.cpp 1512--- a/IGC/Compiler/GenUpdateCB.cpp
1509+++ b/IGC/Compiler/GenUpdateCB.cpp 1513+++ b/IGC/Compiler/GenUpdateCB.cpp
1510@@ -24,6 +24,7 @@ IN THE SOFTWARE. 1514@@ -8,6 +8,7 @@ SPDX-License-Identifier: MIT
1511 1515
1512 #include "common/LLVMWarningsPush.hpp" 1516 #include "common/LLVMWarningsPush.hpp"
1513 #include "llvmWrapper/Bitcode/BitcodeWriter.h" 1517 #include "llvmWrapper/Bitcode/BitcodeWriter.h"
@@ -1515,7 +1519,7 @@ index 89b414b6..9034066c 100644
1515 #include <llvm/Support/ScaledNumber.h> 1519 #include <llvm/Support/ScaledNumber.h>
1516 #include <llvm/Bitcode/BitcodeReader.h> 1520 #include <llvm/Bitcode/BitcodeReader.h>
1517 #include "llvm/IR/DebugInfo.h" 1521 #include "llvm/IR/DebugInfo.h"
1518@@ -384,7 +385,7 @@ bool GenUpdateCB::runOnFunction(Function& F) 1522@@ -368,7 +369,7 @@ bool GenUpdateCB::runOnFunction(Function& F)
1519 isResInfo(dyn_cast<GenIntrinsicInst>(inst, 1523 isResInfo(dyn_cast<GenIntrinsicInst>(inst,
1520 GenISAIntrinsic::GenISA_resinfoptr), texId, lod, isUAV)) 1524 GenISAIntrinsic::GenISA_resinfoptr), texId, lod, isUAV))
1521 { 1525 {
@@ -1525,10 +1529,10 @@ index 89b414b6..9034066c 100644
1525 if (VectorUsedByConstExtractOnly(inst, extracts)) 1529 if (VectorUsedByConstExtractOnly(inst, extracts))
1526 { 1530 {
1527diff --git a/IGC/Compiler/HandleFRemInstructions.cpp b/IGC/Compiler/HandleFRemInstructions.cpp 1531diff --git a/IGC/Compiler/HandleFRemInstructions.cpp b/IGC/Compiler/HandleFRemInstructions.cpp
1528index 94995a56..4523f3f0 100644 1532index 6b48f0b28..8025667f1 100644
1529--- a/IGC/Compiler/HandleFRemInstructions.cpp 1533--- a/IGC/Compiler/HandleFRemInstructions.cpp
1530+++ b/IGC/Compiler/HandleFRemInstructions.cpp 1534+++ b/IGC/Compiler/HandleFRemInstructions.cpp
1531@@ -28,6 +28,7 @@ IN THE SOFTWARE. 1535@@ -12,6 +12,7 @@ SPDX-License-Identifier: MIT
1532 #include <llvm/IR/Instructions.h> 1536 #include <llvm/IR/Instructions.h>
1533 #include <llvm/IR/InstIterator.h> 1537 #include <llvm/IR/InstIterator.h>
1534 #include <llvm/Transforms/Utils/BasicBlockUtils.h> 1538 #include <llvm/Transforms/Utils/BasicBlockUtils.h>
@@ -1536,7 +1540,7 @@ index 94995a56..4523f3f0 100644
1536 #include "common/LLVMWarningsPop.hpp" 1540 #include "common/LLVMWarningsPop.hpp"
1537 #include "Compiler/IGCPassSupport.h" 1541 #include "Compiler/IGCPassSupport.h"
1538 #include "Probe/Assertion.h" 1542 #include "Probe/Assertion.h"
1539@@ -77,7 +78,7 @@ void HandleFRemInstructions::visitFRem(llvm::BinaryOperator& I) 1543@@ -61,7 +62,7 @@ void HandleFRemInstructions::visitFRem(llvm::BinaryOperator& I)
1540 1544
1541 if (ValType->isVectorTy()) 1545 if (ValType->isVectorTy())
1542 { 1546 {
@@ -1546,10 +1550,10 @@ index 94995a56..4523f3f0 100644
1546 { 1550 {
1547 VecStr = "v" + std::to_string(VecCount); 1551 VecStr = "v" + std::to_string(VecCount);
1548diff --git a/IGC/Compiler/HandleLoadStoreInstructions.cpp b/IGC/Compiler/HandleLoadStoreInstructions.cpp 1552diff --git a/IGC/Compiler/HandleLoadStoreInstructions.cpp b/IGC/Compiler/HandleLoadStoreInstructions.cpp
1549index d18eec73..c5535701 100644 1553index 40e9930b5..8c2e60018 100644
1550--- a/IGC/Compiler/HandleLoadStoreInstructions.cpp 1554--- a/IGC/Compiler/HandleLoadStoreInstructions.cpp
1551+++ b/IGC/Compiler/HandleLoadStoreInstructions.cpp 1555+++ b/IGC/Compiler/HandleLoadStoreInstructions.cpp
1552@@ -77,7 +77,7 @@ void HandleLoadStoreInstructions::visitLoadInst(llvm::LoadInst& I) 1556@@ -61,7 +61,7 @@ void HandleLoadStoreInstructions::visitLoadInst(llvm::LoadInst& I)
1553 1557
1554 if (I.getType()->isVectorTy()) 1558 if (I.getType()->isVectorTy())
1555 { 1559 {
@@ -1558,7 +1562,7 @@ index d18eec73..c5535701 100644
1558 doubleDstType = IGCLLVM::FixedVectorType::get(builder.getDoubleTy(), numVectorElements); 1562 doubleDstType = IGCLLVM::FixedVectorType::get(builder.getDoubleTy(), numVectorElements);
1559 } 1563 }
1560 uint as = ptrv->getType()->getPointerAddressSpace(); 1564 uint as = ptrv->getType()->getPointerAddressSpace();
1561@@ -163,7 +163,7 @@ void HandleLoadStoreInstructions::visitStoreInst(llvm::StoreInst& I) 1565@@ -134,7 +134,7 @@ void HandleLoadStoreInstructions::visitStoreInst(llvm::StoreInst& I)
1562 1566
1563 if (I.getValueOperand()->getType()->isVectorTy()) 1567 if (I.getValueOperand()->getType()->isVectorTy())
1564 { 1568 {
@@ -1568,10 +1572,10 @@ index d18eec73..c5535701 100644
1568 1572
1569 1573
1570diff --git a/IGC/Compiler/LegalizationPass.cpp b/IGC/Compiler/LegalizationPass.cpp 1574diff --git a/IGC/Compiler/LegalizationPass.cpp b/IGC/Compiler/LegalizationPass.cpp
1571index b651350b..9524a495 100644 1575index bc03b251d..aa63e2b92 100644
1572--- a/IGC/Compiler/LegalizationPass.cpp 1576--- a/IGC/Compiler/LegalizationPass.cpp
1573+++ b/IGC/Compiler/LegalizationPass.cpp 1577+++ b/IGC/Compiler/LegalizationPass.cpp
1574@@ -670,7 +670,7 @@ void Legalization::visitBitCastInst(llvm::BitCastInst& I) 1578@@ -671,7 +671,7 @@ void Legalization::visitBitCastInst(llvm::BitCastInst& I)
1575 if (!isa<TruncInst>(pZ->getOperand(0))) 1579 if (!isa<TruncInst>(pZ->getOperand(0)))
1576 return; 1580 return;
1577 1581
@@ -1580,7 +1584,7 @@ index b651350b..9524a495 100644
1580 if (pVecTy->getNumElements() != 3) 1584 if (pVecTy->getNumElements() != 3)
1581 return; 1585 return;
1582 1586
1583@@ -765,7 +765,7 @@ void Legalization::visitSelectInst(SelectInst& I) 1587@@ -766,7 +766,7 @@ void Legalization::visitSelectInst(SelectInst& I)
1584 } 1588 }
1585 else if (I.getType()->isVectorTy()) 1589 else if (I.getType()->isVectorTy())
1586 { 1590 {
@@ -1589,7 +1593,7 @@ index b651350b..9524a495 100644
1589 Value* newVec = UndefValue::get(I.getType()); 1593 Value* newVec = UndefValue::get(I.getType());
1590 m_builder->SetInsertPoint(&I); 1594 m_builder->SetInsertPoint(&I);
1591 for (unsigned int i = 0; i < vecSize; i++) 1595 for (unsigned int i = 0; i < vecSize; i++)
1592@@ -1147,7 +1147,7 @@ void Legalization::visitStoreInst(StoreInst& I) 1596@@ -1148,7 +1148,7 @@ void Legalization::visitStoreInst(StoreInst& I)
1593 if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0))) 1597 if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0)))
1594 { 1598 {
1595 Value* newVec = UndefValue::get(vec->getType()); 1599 Value* newVec = UndefValue::get(vec->getType());
@@ -1607,7 +1611,7 @@ index b651350b..9524a495 100644
1607 for (unsigned int i = 0; i < nbElement; i++) 1611 for (unsigned int i = 0; i < nbElement; i++)
1608 { 1612 {
1609 Constant* cst = vec->getOperand(i); 1613 Constant* cst = vec->getOperand(i);
1610@@ -1189,7 +1189,7 @@ void Legalization::visitStoreInst(StoreInst& I) 1614@@ -1188,7 +1188,7 @@ void Legalization::visitStoreInst(StoreInst& I)
1611 else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0))) 1615 else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0)))
1612 { 1616 {
1613 Value* newVec = UndefValue::get(vec->getType()); 1617 Value* newVec = UndefValue::get(vec->getType());
@@ -1616,7 +1620,7 @@ index b651350b..9524a495 100644
1616 for (unsigned int i = 0; i < nbElement; i++) 1620 for (unsigned int i = 0; i < nbElement; i++)
1617 { 1621 {
1618 Constant* cst = vec->getElementValue(i); 1622 Constant* cst = vec->getElementValue(i);
1619@@ -1340,7 +1340,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I) 1623@@ -1338,7 +1338,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1620 if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0))) 1624 if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0)))
1621 { 1625 {
1622 Value* newVec = UndefValue::get(vec->getType()); 1626 Value* newVec = UndefValue::get(vec->getType());
@@ -1625,7 +1629,7 @@ index b651350b..9524a495 100644
1625 for (unsigned int i = 0; i < nbElement; i++) 1629 for (unsigned int i = 0; i < nbElement; i++)
1626 { 1630 {
1627 Constant* cst = vec->getElementAsConstant(i); 1631 Constant* cst = vec->getElementAsConstant(i);
1628@@ -1360,7 +1360,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I) 1632@@ -1358,7 +1358,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1629 else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0))) 1633 else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0)))
1630 { 1634 {
1631 Value* newVec = UndefValue::get(I.getType()); 1635 Value* newVec = UndefValue::get(I.getType());
@@ -1634,7 +1638,7 @@ index b651350b..9524a495 100644
1634 for (unsigned int i = 0; i < nbElement; i++) 1638 for (unsigned int i = 0; i < nbElement; i++)
1635 { 1639 {
1636 Constant* cst = vec->getOperand(i); 1640 Constant* cst = vec->getOperand(i);
1637@@ -1380,7 +1380,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I) 1641@@ -1378,7 +1378,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1638 else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0))) 1642 else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0)))
1639 { 1643 {
1640 Value* newVec = UndefValue::get(I.getType()); 1644 Value* newVec = UndefValue::get(I.getType());
@@ -1643,7 +1647,7 @@ index b651350b..9524a495 100644
1643 for (unsigned int i = 0; i < nbElement; i++) 1647 for (unsigned int i = 0; i < nbElement; i++)
1644 { 1648 {
1645 Constant* cst = vec->getElementValue(i); 1649 Constant* cst = vec->getElementValue(i);
1646@@ -1397,7 +1397,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I) 1650@@ -1395,7 +1395,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1647 else if (I.getOperand(1)->getType()->isIntegerTy(1)) 1651 else if (I.getOperand(1)->getType()->isIntegerTy(1))
1648 { 1652 {
1649 // This promotes i1 insertelement to i32 1653 // This promotes i1 insertelement to i32
@@ -1652,7 +1656,7 @@ index b651350b..9524a495 100644
1652 Value* newVec = UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), nbElement)); 1656 Value* newVec = UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), nbElement));
1653 PromoteInsertElement(&I, newVec); 1657 PromoteInsertElement(&I, newVec);
1654 } 1658 }
1655@@ -1410,7 +1410,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I) 1659@@ -1408,7 +1408,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I)
1656 // If the original vector is a constant, just use the scalar constant, 1660 // If the original vector is a constant, just use the scalar constant,
1657 // otherwise extract from the original vector. 1661 // otherwise extract from the original vector.
1658 1662
@@ -1661,7 +1665,7 @@ index b651350b..9524a495 100644
1661 Value* newVec = UndefValue::get(resType); 1665 Value* newVec = UndefValue::get(resType);
1662 Value* src0 = I.getOperand(0); 1666 Value* src0 = I.getOperand(0);
1663 Value* src1 = I.getOperand(1); 1667 Value* src1 = I.getOperand(1);
1664@@ -1421,7 +1421,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I) 1668@@ -1419,7 +1419,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I)
1665 Constant* mask = I.getShuffleMaskForBitcode(); 1669 Constant* mask = I.getShuffleMaskForBitcode();
1666 #endif 1670 #endif
1667 // The two inputs are guaranteed to be of the same type 1671 // The two inputs are guaranteed to be of the same type
@@ -1670,7 +1674,7 @@ index b651350b..9524a495 100644
1670 int inCount = int_cast<int>(inType->getNumElements()); 1674 int inCount = int_cast<int>(inType->getNumElements());
1671 int inBase = 2; // 2 means using undef 1675 int inBase = 2; // 2 means using undef
1672 // if inType == resType, use src0/src1 as the input 1676 // if inType == resType, use src0/src1 as the input
1673@@ -1637,7 +1637,7 @@ Type* Legalization::LegalAllocaType(Type* type) const 1677@@ -1635,7 +1635,7 @@ Type* Legalization::LegalAllocaType(Type* type) const
1674 #endif 1678 #endif
1675 legalType = IGCLLVM::FixedVectorType::get( 1679 legalType = IGCLLVM::FixedVectorType::get(
1676 LegalAllocaType(cast<VectorType>(type)->getElementType()), 1680 LegalAllocaType(cast<VectorType>(type)->getElementType()),
@@ -1679,7 +1683,7 @@ index b651350b..9524a495 100644
1679 break; 1683 break;
1680 case Type::StructTyID: 1684 case Type::StructTyID:
1681 return LegalStructAllocaType(type); 1685 return LegalStructAllocaType(type);
1682@@ -1937,7 +1937,7 @@ void Legalization::visitIntrinsicInst(llvm::IntrinsicInst& I) 1686@@ -1976,7 +1976,7 @@ void Legalization::visitIntrinsicInst(llvm::IntrinsicInst& I)
1683 Value* newValue = nullptr; 1687 Value* newValue = nullptr;
1684 if (srcType->isVectorTy()) 1688 if (srcType->isVectorTy())
1685 { 1689 {
@@ -1688,7 +1692,7 @@ index b651350b..9524a495 100644
1688 const unsigned int numElements = (uint32_t)sourceVT->getNumElements(); 1692 const unsigned int numElements = (uint32_t)sourceVT->getNumElements();
1689 Value* dstVec = UndefValue::get(srcType); 1693 Value* dstVec = UndefValue::get(srcType);
1690 for (unsigned int i = 0; i < numElements; ++i) 1694 for (unsigned int i = 0; i < numElements; ++i)
1691@@ -2081,7 +2081,7 @@ void Legalization::visitTruncInst(llvm::TruncInst& I) { 1695@@ -2119,7 +2119,7 @@ void Legalization::visitTruncInst(llvm::TruncInst& I) {
1692 } 1696 }
1693 1697
1694 Src = BC->getOperand(0); 1698 Src = BC->getOperand(0);
@@ -1698,41 +1702,23 @@ index b651350b..9524a495 100644
1698 if (!VTy || VTy->getNumElements() != 3 || !VTy->getElementType()->isIntegerTy(16)) 1702 if (!VTy || VTy->getNumElements() != 3 || !VTy->getElementType()->isIntegerTy(16))
1699 return; 1703 return;
1700diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp 1704diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp
1701index bba1d96d..8fadf89f 100644 1705index 56c0b9981..6d1778b61 100644
1702--- a/IGC/Compiler/Legalizer/InstPromoter.cpp 1706--- a/IGC/Compiler/Legalizer/InstPromoter.cpp
1703+++ b/IGC/Compiler/Legalizer/InstPromoter.cpp 1707+++ b/IGC/Compiler/Legalizer/InstPromoter.cpp
1704@@ -25,6 +25,7 @@ IN THE SOFTWARE. 1708@@ -382,7 +382,7 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) {
1705 #define DEBUG_TYPE "type-legalizer" 1709 IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N));
1706 #include "TypeLegalizer.h"
1707 #include "InstPromoter.h"
1708+#include "llvmWrapper/IR/DerivedTypes.h"
1709 #include "common/LLVMWarningsPush.hpp"
1710 #include "llvm/Support/Debug.h"
1711 #include "llvm/Support/MathExtras.h"
1712@@ -394,10 +395,16 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) {
1713 unsigned N =
1714 Val->getType()->getScalarSizeInBits() / DestTy->getScalarSizeInBits();
1715 Value* BC =
1716- IRB->CreateBitCast(Val, VectorType::get(DestTy->getScalarType(), N));
1717+ IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N));
1718 1710
1719 std::vector<Constant*> Vals; 1711 std::vector<Constant*> Vals;
1720- for (unsigned i = 0; i < DestTy->getVectorNumElements(); i++) 1712- for (unsigned i = 0; i < (unsigned)cast<VectorType>(DestTy)->getNumElements(); i++)
1721+ for (unsigned i = 0; 1713+ for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements(); i++)
1722+#if LLVM_VERSION_MAJOR >= 12
1723+ i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements();
1724+#else
1725+ i < DestTy->getVectorNumElements();
1726+#endif
1727+ i++)
1728 Vals.push_back(IRB->getInt32(i)); 1714 Vals.push_back(IRB->getInt32(i));
1729 1715
1730 Value* Mask = ConstantVector::get(Vals); 1716 Value* Mask = ConstantVector::get(Vals);
1731diff --git a/IGC/Compiler/Legalizer/InstScalarizer.cpp b/IGC/Compiler/Legalizer/InstScalarizer.cpp 1717diff --git a/IGC/Compiler/Legalizer/InstScalarizer.cpp b/IGC/Compiler/Legalizer/InstScalarizer.cpp
1732index 3902f740..c8e18cc5 100644 1718index c2b3f7ba7..2e519eef0 100644
1733--- a/IGC/Compiler/Legalizer/InstScalarizer.cpp 1719--- a/IGC/Compiler/Legalizer/InstScalarizer.cpp
1734+++ b/IGC/Compiler/Legalizer/InstScalarizer.cpp 1720+++ b/IGC/Compiler/Legalizer/InstScalarizer.cpp
1735@@ -130,7 +130,7 @@ bool InstScalarizer::visitLoadInst(LoadInst& I) { 1721@@ -114,7 +114,7 @@ bool InstScalarizer::visitLoadInst(LoadInst& I) {
1736 // otherwise, it's broken. 1722 // otherwise, it's broken.
1737 IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy)); 1723 IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy));
1738 1724
@@ -1741,7 +1727,7 @@ index 3902f740..c8e18cc5 100644
1741 unsigned Elt = 0; 1727 unsigned Elt = 0;
1742 1728
1743 Type* NewPtrTy = PointerType::get(EltTy, AS); 1729 Type* NewPtrTy = PointerType::get(EltTy, AS);
1744@@ -268,7 +268,7 @@ bool InstScalarizer::visitStoreInst(StoreInst& I) { 1730@@ -252,7 +252,7 @@ bool InstScalarizer::visitStoreInst(StoreInst& I) {
1745 // otherwise, it's broken. 1731 // otherwise, it's broken.
1746 IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy)); 1732 IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy));
1747 1733
@@ -1750,7 +1736,7 @@ index 3902f740..c8e18cc5 100644
1750 unsigned Elt = 0; 1736 unsigned Elt = 0;
1751 1737
1752 Type* NewPtrTy = PointerType::get(EltTy, AS); 1738 Type* NewPtrTy = PointerType::get(EltTy, AS);
1753@@ -498,7 +498,7 @@ bool InstScalarizer::visitInsertElementInst(InsertElementInst& I) { 1739@@ -482,7 +482,7 @@ bool InstScalarizer::visitInsertElementInst(InsertElementInst& I) {
1754 IGC_ASSERT(EltSeq->size()); 1740 IGC_ASSERT(EltSeq->size());
1755 IGC_ASSERT(VecSeqCopy.size() % EltSeq->size() == 0); 1741 IGC_ASSERT(VecSeqCopy.size() % EltSeq->size() == 0);
1756 1742
@@ -1760,10 +1746,10 @@ index 3902f740..c8e18cc5 100644
1760 for (unsigned Elt = 0; Elt != NumElts; ++Elt) { 1746 for (unsigned Elt = 0; Elt != NumElts; ++Elt) {
1761 if (Elt == Idx) { 1747 if (Elt == Idx) {
1762diff --git a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp 1748diff --git a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
1763index 28f8ce84..778132c4 100644 1749index 5257de424..7d93665dc 100644
1764--- a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp 1750--- a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
1765+++ b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp 1751+++ b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
1766@@ -162,7 +162,7 @@ void PeepholeTypeLegalizer::legalizePhiInstruction(Instruction& I) 1752@@ -146,7 +146,7 @@ void PeepholeTypeLegalizer::legalizePhiInstruction(Instruction& I)
1767 1753
1768 if (quotient > 1) 1754 if (quotient > 1)
1769 { 1755 {
@@ -1772,7 +1758,7 @@ index 28f8ce84..778132c4 100644
1772 Type* newType = IGCLLVM::FixedVectorType::get(Type::getIntNTy(I.getContext(), promoteToInt), quotient * numElements); 1758 Type* newType = IGCLLVM::FixedVectorType::get(Type::getIntNTy(I.getContext(), promoteToInt), quotient * numElements);
1773 1759
1774 PHINode* newPhi = m_builder->CreatePHI(newType, oldPhi->getNumIncomingValues()); 1760 PHINode* newPhi = m_builder->CreatePHI(newType, oldPhi->getNumIncomingValues());
1775@@ -223,7 +223,7 @@ void PeepholeTypeLegalizer::legalizeExtractElement(Instruction& I) 1761@@ -207,7 +207,7 @@ void PeepholeTypeLegalizer::legalizeExtractElement(Instruction& I)
1776 unsigned elementWidth = extract->getType()->getScalarSizeInBits(); 1762 unsigned elementWidth = extract->getType()->getScalarSizeInBits();
1777 if (!isLegalInteger(elementWidth) && extract->getType()->isIntOrIntVectorTy()) 1763 if (!isLegalInteger(elementWidth) && extract->getType()->isIntOrIntVectorTy())
1778 { 1764 {
@@ -1781,7 +1767,7 @@ index 28f8ce84..778132c4 100644
1781 unsigned quotient, promoteToInt; 1767 unsigned quotient, promoteToInt;
1782 promoteInt(elementWidth, quotient, promoteToInt, DL->getLargestLegalIntTypeSizeInBits()); 1768 promoteInt(elementWidth, quotient, promoteToInt, DL->getLargestLegalIntTypeSizeInBits());
1783 1769
1784@@ -850,7 +850,7 @@ void PeepholeTypeLegalizer::cleanupZExtInst(Instruction& I) { 1770@@ -834,7 +834,7 @@ void PeepholeTypeLegalizer::cleanupZExtInst(Instruction& I) {
1785 } 1771 }
1786 1772
1787 unsigned ipElmtSize = prevInst->getOperand(0)->getType()->getScalarSizeInBits(); 1773 unsigned ipElmtSize = prevInst->getOperand(0)->getType()->getScalarSizeInBits();
@@ -1791,10 +1777,10 @@ index 28f8ce84..778132c4 100644
1791 1777
1792 Value* vecRes = UndefValue::get(IGCLLVM::FixedVectorType::get(llvm::Type::getIntNTy(I.getContext(), promoteToInt), quotient)); 1778 Value* vecRes = UndefValue::get(IGCLLVM::FixedVectorType::get(llvm::Type::getIntNTy(I.getContext(), promoteToInt), quotient));
1793diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.cpp b/IGC/Compiler/Legalizer/TypeLegalizer.cpp 1779diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.cpp b/IGC/Compiler/Legalizer/TypeLegalizer.cpp
1794index f8f71d71..a46f42bd 100644 1780index 6dfdae07e..03f866f14 100644
1795--- a/IGC/Compiler/Legalizer/TypeLegalizer.cpp 1781--- a/IGC/Compiler/Legalizer/TypeLegalizer.cpp
1796+++ b/IGC/Compiler/Legalizer/TypeLegalizer.cpp 1782+++ b/IGC/Compiler/Legalizer/TypeLegalizer.cpp
1797@@ -32,6 +32,7 @@ IN THE SOFTWARE. 1783@@ -16,6 +16,7 @@ SPDX-License-Identifier: MIT
1798 #include "InstScalarizer.h" 1784 #include "InstScalarizer.h"
1799 #include "InstElementizer.h" 1785 #include "InstElementizer.h"
1800 #include "common/LLVMWarningsPush.hpp" 1786 #include "common/LLVMWarningsPush.hpp"
@@ -1802,7 +1788,7 @@ index f8f71d71..a46f42bd 100644
1802 #include "llvm/ADT/PostOrderIterator.h" 1788 #include "llvm/ADT/PostOrderIterator.h"
1803 #include "llvm/IR/CFG.h" 1789 #include "llvm/IR/CFG.h"
1804 #include "llvm/Support/Debug.h" 1790 #include "llvm/Support/Debug.h"
1805@@ -290,7 +291,7 @@ TypeSeq* TypeLegalizer::getScalarizedTypeSeq(Type* Ty) { 1791@@ -274,7 +275,7 @@ TypeSeq* TypeLegalizer::getScalarizedTypeSeq(Type* Ty) {
1806 } 1792 }
1807 1793
1808 Type* EltTy = cast<VectorType>(Ty)->getElementType(); 1794 Type* EltTy = cast<VectorType>(Ty)->getElementType();
@@ -1812,10 +1798,10 @@ index f8f71d71..a46f42bd 100644
1812 1798
1813 return &TMI->second; 1799 return &TMI->second;
1814diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.h b/IGC/Compiler/Legalizer/TypeLegalizer.h 1800diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.h b/IGC/Compiler/Legalizer/TypeLegalizer.h
1815index f3ce264c..a6910d08 100644 1801index b51f00ac7..ee6d41992 100644
1816--- a/IGC/Compiler/Legalizer/TypeLegalizer.h 1802--- a/IGC/Compiler/Legalizer/TypeLegalizer.h
1817+++ b/IGC/Compiler/Legalizer/TypeLegalizer.h 1803+++ b/IGC/Compiler/Legalizer/TypeLegalizer.h
1818@@ -28,6 +28,7 @@ IN THE SOFTWARE. 1804@@ -12,6 +12,7 @@ SPDX-License-Identifier: MIT
1819 #include "llvmWrapper/IR/Instructions.h" 1805 #include "llvmWrapper/IR/Instructions.h"
1820 #include "llvmWrapper/Analysis/InlineCost.h" 1806 #include "llvmWrapper/Analysis/InlineCost.h"
1821 #include "llvmWrapper/IR/InstrTypes.h" 1807 #include "llvmWrapper/IR/InstrTypes.h"
@@ -1823,7 +1809,7 @@ index f3ce264c..a6910d08 100644
1823 #include "llvmWrapper/Support/Alignment.h" 1809 #include "llvmWrapper/Support/Alignment.h"
1824 #include "llvm/ADT/ArrayRef.h" 1810 #include "llvm/ADT/ArrayRef.h"
1825 #include "llvm/ADT/DenseMap.h" 1811 #include "llvm/ADT/DenseMap.h"
1826@@ -287,7 +288,7 @@ namespace IGC { 1812@@ -271,7 +272,7 @@ namespace IGC {
1827 if (!Ty->isVectorTy()) 1813 if (!Ty->isVectorTy())
1828 return false; 1814 return false;
1829 1815
@@ -1833,52 +1819,35 @@ index f3ce264c..a6910d08 100644
1833 const auto& ProfitLengths = getProfitLoadVectorLength(EltTy); 1819 const auto& ProfitLengths = getProfitLoadVectorLength(EltTy);
1834 1820
1835diff --git a/IGC/Compiler/LowPrecisionOptPass.cpp b/IGC/Compiler/LowPrecisionOptPass.cpp 1821diff --git a/IGC/Compiler/LowPrecisionOptPass.cpp b/IGC/Compiler/LowPrecisionOptPass.cpp
1836index 64912719..1d1db949 100644 1822index b7a1474f4..e3d65bc18 100644
1837--- a/IGC/Compiler/LowPrecisionOptPass.cpp 1823--- a/IGC/Compiler/LowPrecisionOptPass.cpp
1838+++ b/IGC/Compiler/LowPrecisionOptPass.cpp 1824+++ b/IGC/Compiler/LowPrecisionOptPass.cpp
1839@@ -252,7 +252,7 @@ bool LowPrecisionOpt::propagateSamplerType(llvm::GenIntrinsicInst& I) 1825@@ -253,7 +253,7 @@ bool LowPrecisionOpt::propagateSamplerType(llvm::GenIntrinsicInst& I)
1840 return false; 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());
1841 } 1831 }
1842 1832
1843- VectorType* oldTy = cast<VectorType>(I.getType());
1844+ IGCLLVM::FixedVectorType* oldTy = cast<IGCLLVM::FixedVectorType>(I.getType());
1845 llvm::SmallVector<llvm::Type*, 4> overloadTys; 1833 llvm::SmallVector<llvm::Type*, 4> overloadTys;
1846 auto retTy = IGCLLVM::FixedVectorType::get(newDstType, int_cast<unsigned int>(oldTy->getNumElements()));
1847 overloadTys.push_back(retTy);
1848diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp 1834diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
1849index 393b4b0a..e9c07b34 100644 1835index b22e14bd5..a2b5927ea 100644
1850--- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp 1836--- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
1851+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp 1837+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp
1852@@ -23,6 +23,8 @@ IN THE SOFTWARE. 1838@@ -7,6 +7,7 @@ SPDX-License-Identifier: MIT
1853 ============================= end_copyright_notice ===========================*/ 1839 ============================= end_copyright_notice ===========================*/
1854 1840
1855 #include "llvm/Config/llvm-config.h" 1841 #include "llvm/Config/llvm-config.h"
1856+#include "llvmWrapper/IR/DerivedTypes.h" 1842+#include <llvm/Analysis/TargetLibraryInfo.h>
1857+#include "llvmWrapper/Analysis/TargetLibraryInfo.h"
1858 #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h" 1843 #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h"
1859 #include "Compiler/CodeGenPublic.h" 1844 #include "Compiler/CodeGenPublic.h"
1860 #include "Compiler/IGCPassSupport.h" 1845 #include "Compiler/IGCPassSupport.h"
1861@@ -178,12 +180,11 @@ namespace {
1862 bool doInitialization(Module& M) override {
1863 if(M.size() > 0)
1864 {
1865- Result.reset(new AddressSpaceAAResult(
1866- getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(
1867 #if LLVM_VERSION_MAJOR >= 10
1868- *M.begin()
1869+ Function &F = *M.begin();
1870 #endif
1871- ),
1872+ Result.reset(new AddressSpaceAAResult(
1873+ getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(),
1874 *getAnalysis<CodeGenContextWrapper>().getCodeGenContext()));
1875 }
1876 return false;
1877diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp 1846diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
1878index 67535cfc..3cdd2975 100644 1847index 0edacda24..7c0e7936d 100644
1879--- a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp 1848--- a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
1880+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp 1849+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
1881@@ -24,6 +24,7 @@ IN THE SOFTWARE. 1850@@ -8,6 +8,7 @@ SPDX-License-Identifier: MIT
1882 1851
1883 #include "Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.hpp" 1852 #include "Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.hpp"
1884 #include "Compiler/IGCPassSupport.h" 1853 #include "Compiler/IGCPassSupport.h"
@@ -1886,7 +1855,7 @@ index 67535cfc..3cdd2975 100644
1886 #include "common/LLVMWarningsPush.hpp" 1855 #include "common/LLVMWarningsPush.hpp"
1887 #include "llvm/IR/Function.h" 1856 #include "llvm/IR/Function.h"
1888 #include "common/LLVMWarningsPop.hpp" 1857 #include "common/LLVMWarningsPop.hpp"
1889@@ -130,7 +131,7 @@ static uint64_t getNumElements(Type* type) 1858@@ -114,7 +115,7 @@ static uint64_t getNumElements(Type* type)
1890 { 1859 {
1891 return arrayType->getNumElements(); 1860 return arrayType->getNumElements();
1892 } 1861 }
@@ -1896,10 +1865,10 @@ index 67535cfc..3cdd2975 100644
1896 return vectorType->getNumElements(); 1865 return vectorType->getNumElements();
1897 } 1866 }
1898diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp 1867diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
1899index 2a9d7499..79ed0948 100644 1868index 68b188d0b..ecc1b648a 100644
1900--- a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp 1869--- a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
1901+++ b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp 1870+++ b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
1902@@ -27,6 +27,7 @@ IN THE SOFTWARE. 1871@@ -11,6 +11,7 @@ SPDX-License-Identifier: MIT
1903 #include "Compiler/IGCPassSupport.h" 1872 #include "Compiler/IGCPassSupport.h"
1904 #include "GenISAIntrinsics/GenIntrinsicInst.h" 1873 #include "GenISAIntrinsics/GenIntrinsicInst.h"
1905 1874
@@ -1907,7 +1876,7 @@ index 2a9d7499..79ed0948 100644
1907 #include "common/LLVMWarningsPush.hpp" 1876 #include "common/LLVMWarningsPush.hpp"
1908 #include <llvm/IR/Function.h> 1877 #include <llvm/IR/Function.h>
1909 #include <llvm/IR/Instructions.h> 1878 #include <llvm/IR/Instructions.h>
1910@@ -133,7 +134,7 @@ Value* CorrectlyRoundedDivSqrt::emitIEEEDivide(BinaryOperator* I, Value* Op0, Va 1879@@ -117,7 +118,7 @@ Value* CorrectlyRoundedDivSqrt::emitIEEEDivide(BinaryOperator* I, Value* Op0, Va
1911 } 1880 }
1912 else 1881 else
1913 { 1882 {
@@ -1917,22 +1886,19 @@ index 2a9d7499..79ed0948 100644
1917 Divide = UndefValue::get(Ty); 1886 Divide = UndefValue::get(Ty);
1918 for (unsigned i = 0; i < VecLen; i++) 1887 for (unsigned i = 0; i < VecLen; i++)
1919diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp 1888diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
1920index c5ff3ac0..119520ed 100644 1889index 387350066..86673d224 100644
1921--- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp 1890--- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
1922+++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp 1891+++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
1923@@ -952,7 +952,11 @@ namespace //Anonymous 1892@@ -937,7 +937,7 @@ namespace //Anonymous
1924 { 1893 {
1925 auto ndrangeStructName = "struct.ndrange_t"; 1894 auto ndrangeStructName = "struct.ndrange_t";
1926 auto module = _deviceExecCall->getModule(); 1895 auto module = _deviceExecCall->getModule();
1927+#if LLVM_VERSION_MAJOR >= 12 1896- auto ndrangeTy = module->getTypeByName(ndrangeStructName);
1928+ auto ndrangeTy = llvm::StructType::getTypeByName(module->getContext(), ndrangeStructName); 1897+ auto ndrangeTy = IGCLLVM::getTypeByName(module, ndrangeStructName);
1929+#else
1930 auto ndrangeTy = module->getTypeByName(ndrangeStructName);
1931+#endif
1932 if (ndrangeTy == nullptr) 1898 if (ndrangeTy == nullptr)
1933 { 1899 {
1934 //create struct type 1900 //create struct type
1935@@ -1697,7 +1701,7 @@ namespace //Anonymous 1901@@ -1682,7 +1682,7 @@ namespace //Anonymous
1936 // this generates <element_type><num_elements> string. Ie for char2 element_type is char and num_elements is 2 1902 // this generates <element_type><num_elements> string. Ie for char2 element_type is char and num_elements is 2
1937 // that is done by callin BaseTypeName on vector element type, this recursive call has only a depth of one since 1903 // that is done by callin BaseTypeName on vector element type, this recursive call has only a depth of one since
1938 // there are no compound vectors in OpenCL. 1904 // there are no compound vectors in OpenCL.
@@ -1942,10 +1908,10 @@ index c5ff3ac0..119520ed 100644
1942 } 1908 }
1943 default: 1909 default:
1944diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp 1910diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
1945index 6448463d..7df71079 100644 1911index 4a7ce70b4..0178f4652 100644
1946--- a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp 1912--- a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
1947+++ b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp 1913+++ b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
1948@@ -24,6 +24,7 @@ IN THE SOFTWARE. 1914@@ -8,6 +8,7 @@ SPDX-License-Identifier: MIT
1949 1915
1950 #include "Compiler/Optimizer/OpenCLPasses/KernelArgs.hpp" 1916 #include "Compiler/Optimizer/OpenCLPasses/KernelArgs.hpp"
1951 #include "AdaptorCommon/ImplicitArgs.hpp" 1917 #include "AdaptorCommon/ImplicitArgs.hpp"
@@ -1953,7 +1919,7 @@ index 6448463d..7df71079 100644
1953 #include "common/LLVMWarningsPush.hpp" 1919 #include "common/LLVMWarningsPush.hpp"
1954 #include <llvm/IR/Argument.h> 1920 #include <llvm/IR/Argument.h>
1955 #include <llvm/IR/DataLayout.h> 1921 #include <llvm/IR/DataLayout.h>
1956@@ -388,7 +389,7 @@ unsigned int KernelArg::calcAssociatedArgNo(const ImplicitArg& implicitArg, cons 1922@@ -372,7 +373,7 @@ unsigned int KernelArg::calcAssociatedArgNo(const ImplicitArg& implicitArg, cons
1957 1923
1958 unsigned int KernelArg::getNumComponents() const 1924 unsigned int KernelArg::getNumComponents() const
1959 { 1925 {
@@ -1963,10 +1929,10 @@ index 6448463d..7df71079 100644
1963 // Vector 1929 // Vector
1964 return int_cast<unsigned int>(vecType->getNumElements()); 1930 return int_cast<unsigned int>(vecType->getNumElements());
1965diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp 1931diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
1966index c7414b8e..74964510 100644 1932index 92c534a10..711fb6b01 100644
1967--- a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp 1933--- a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
1968+++ b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp 1934+++ b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
1969@@ -719,7 +719,7 @@ Value* OpenCLPrintfResolution::fixupPrintfArg(CallInst& printfCall, Value* arg, 1935@@ -723,7 +723,7 @@ Value* OpenCLPrintfResolution::fixupPrintfArg(CallInst& printfCall, Value* arg,
1970 } 1936 }
1971 1937
1972 Type* newType = Type::getFloatTy(arg->getContext()); 1938 Type* newType = Type::getFloatTy(arg->getContext());
@@ -1975,7 +1941,7 @@ index c7414b8e..74964510 100644
1975 { 1941 {
1976 newType = IGCLLVM::FixedVectorType::get(newType, (unsigned)argVT->getNumElements()); 1942 newType = IGCLLVM::FixedVectorType::get(newType, (unsigned)argVT->getNumElements());
1977 } 1943 }
1978@@ -749,7 +749,7 @@ void OpenCLPrintfResolution::preprocessPrintfArgs(CallInst& printfCall) 1944@@ -753,7 +753,7 @@ void OpenCLPrintfResolution::preprocessPrintfArgs(CallInst& printfCall)
1979 IGC::SHADER_PRINTF_TYPE argDataType = getPrintfArgDataType(arg); 1945 IGC::SHADER_PRINTF_TYPE argDataType = getPrintfArgDataType(arg);
1980 arg = fixupPrintfArg(printfCall, arg, argDataType); 1946 arg = fixupPrintfArg(printfCall, arg, argDataType);
1981 uint vecSize = 0; 1947 uint vecSize = 0;
@@ -1985,18 +1951,10 @@ index c7414b8e..74964510 100644
1985 } 1951 }
1986 m_argDescriptors.push_back(SPrintfArgDescriptor(argDataType, arg, vecSize)); 1952 m_argDescriptors.push_back(SPrintfArgDescriptor(argDataType, arg, vecSize));
1987diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp 1953diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
1988index 2ed5a2b6..07f85f4c 100644 1954index ac14b2d04..48c7e8637 100644
1989--- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp 1955--- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
1990+++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp 1956+++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
1991@@ -29,6 +29,7 @@ IN THE SOFTWARE. 1957@@ -618,7 +618,7 @@ public:
1992 #include "Compiler/IGCPassSupport.h"
1993 #include "Compiler/CISACodeGen/GenCodeGenModule.h"
1994 #include "Compiler/CISACodeGen/LowerGEPForPrivMem.hpp"
1995+#include "llvmWrapper/IR/DerivedTypes.h"
1996 #include "common/LLVMWarningsPush.hpp"
1997 #include "llvm/Transforms/Utils/Local.h"
1998 #include "llvm/IR/DataLayout.h"
1999@@ -604,7 +605,7 @@ public:
2000 Type* scalarptrTy = PointerType::get(scalarType, pLoad->getPointerAddressSpace()); 1958 Type* scalarptrTy = PointerType::get(scalarType, pLoad->getPointerAddressSpace());
2001 IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize); 1959 IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
2002 Value* vec = UndefValue::get(pLoad->getType()); 1960 Value* vec = UndefValue::get(pLoad->getType());
@@ -2005,7 +1963,7 @@ index 2ed5a2b6..07f85f4c 100644
2005 for (unsigned i = 0, e = (unsigned)pLoadVT->getNumElements(); i < e; ++i) 1963 for (unsigned i = 0, e = (unsigned)pLoadVT->getNumElements(); i < e; ++i)
2006 { 1964 {
2007 Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy); 1965 Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy);
2008@@ -643,7 +644,7 @@ public: 1966@@ -657,7 +657,7 @@ public:
2009 IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize); 1967 IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
2010 Value* vec = pStore->getValueOperand(); 1968 Value* vec = pStore->getValueOperand();
2011 1969
@@ -2014,7 +1972,7 @@ index 2ed5a2b6..07f85f4c 100644
2014 for (unsigned i = 0; i < vecNumElts; ++i) 1972 for (unsigned i = 0; i < vecNumElts; ++i)
2015 { 1973 {
2016 Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy); 1974 Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy);
2017@@ -707,7 +708,7 @@ bool PrivateMemoryResolution::testTransposedMemory(const Type* pTmpType, const T 1975@@ -728,7 +728,7 @@ bool PrivateMemoryResolution::testTransposedMemory(const Type* pTmpType, const T
2018 } 1976 }
2019 else if(pTmpType->isVectorTy()) 1977 else if(pTmpType->isVectorTy())
2020 { 1978 {
@@ -2023,23 +1981,11 @@ index 2ed5a2b6..07f85f4c 100644
2023 tmpAllocaSize *= pTmpVType->getNumElements(); 1981 tmpAllocaSize *= pTmpVType->getNumElements();
2024 pTmpType = pTmpType->getContainedType(0); 1982 pTmpType = pTmpType->getContainedType(0);
2025 ok = (nullptr != pTmpType); 1983 ok = (nullptr != pTmpType);
2026@@ -815,7 +816,11 @@ bool PrivateMemoryResolution::resolveAllocaInstructions(bool privateOnStack)
2027 // Construct an empty DebugLoc.
2028 IF_DEBUG_INFO(DebugLoc entryDebugLoc);
2029 // Assign with the function location if available.
2030+#if LLVM_VERSION_MAJOR >= 12
2031+ IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DILocation::get(subprogram->getContext(), subprogram->getLine(), 0, subprogram););
2032+#else
2033 IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DebugLoc::get(subprogram->getLine(), 0, subprogram););
2034+#endif
2035 IF_DEBUG_INFO(entryBuilder.SetCurrentDebugLocation(entryDebugLoc));
2036
2037 if (privateOnStack)
2038diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp 1984diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
2039index c8414efa..68491d48 100644 1985index 88707c588..ae9c7e671 100644
2040--- a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp 1986--- a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
2041+++ b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp 1987+++ b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
2042@@ -254,7 +254,7 @@ Instruction* ReplaceUnsupportedIntrinsics::insertLoop(Instruction* Loc, Value* L 1988@@ -244,7 +244,7 @@ Instruction* ReplaceUnsupportedIntrinsics::insertLoop(Instruction* Loc, Value* L
2043 Value* ReplaceUnsupportedIntrinsics::replicateScalar( 1989 Value* ReplaceUnsupportedIntrinsics::replicateScalar(
2044 Value* ScalarVal, Type* Ty, Instruction* InsertBefore) 1990 Value* ScalarVal, Type* Ty, Instruction* InsertBefore)
2045 { 1991 {
@@ -2048,7 +1994,7 @@ index c8414efa..68491d48 100644
2048 Type* ETy = VTy ? VTy->getElementType() : Ty; 1994 Type* ETy = VTy ? VTy->getElementType() : Ty;
2049 uint32_t sBits = (unsigned int)ScalarVal->getType()->getPrimitiveSizeInBits(); 1995 uint32_t sBits = (unsigned int)ScalarVal->getType()->getPrimitiveSizeInBits();
2050 uint32_t nBits = (unsigned int)ETy->getPrimitiveSizeInBits(); 1996 uint32_t nBits = (unsigned int)ETy->getPrimitiveSizeInBits();
2051@@ -868,7 +868,7 @@ void ReplaceUnsupportedIntrinsics::replaceFunnelShift(IntrinsicInst* I) { 1997@@ -905,7 +905,7 @@ void ReplaceUnsupportedIntrinsics::replaceFunnelShift(IntrinsicInst* I) {
2052 } 1998 }
2053 1999
2054 Value* numBits = Builder.getIntN(sizeInBits, sizeInBits); 2000 Value* numBits = Builder.getIntN(sizeInBits, sizeInBits);
@@ -2058,26 +2004,23 @@ index c8414efa..68491d48 100644
2058 } 2004 }
2059 auto shiftModulo = Builder.CreateURem(I->getArgOperand(2), numBits); 2005 auto shiftModulo = Builder.CreateURem(I->getArgOperand(2), numBits);
2060diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp 2006diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
2061index 7188cc50..535d6268 100644 2007index a8e24680c..4de05effa 100644
2062--- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp 2008--- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
2063+++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp 2009+++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
2064@@ -303,7 +303,11 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType) 2010@@ -279,7 +279,7 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType)
2065 auto Size = ElemByteSize; 2011 auto Size = ElemByteSize;
2066 if (DataType->isVectorTy()) 2012 if (auto DataVecType = dyn_cast<VectorType>(DataType))
2067 { 2013 {
2068+#if LLVM_VERSION_MAJOR >= 12 2014- Size *= (unsigned int)DataVecType->getNumElements();
2069+ Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements(); 2015+ Size *= cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements();
2070+#else
2071 Size *= DataType->getVectorNumElements();
2072+#endif
2073 } 2016 }
2074 unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize; 2017 unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize;
2075 unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2; 2018 unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2;
2076diff --git a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp 2019diff --git a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
2077index 1fda21d5..63a22864 100644 2020index 248ab1039..423beef7b 100644
2078--- a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp 2021--- a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
2079+++ b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp 2022+++ b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
2080@@ -340,7 +340,7 @@ bool PreCompiledFuncImport::preProcessDouble() 2023@@ -339,7 +339,7 @@ bool PreCompiledFuncImport::preProcessDouble()
2081 } 2024 }
2082 else 2025 else
2083 { 2026 {
@@ -2086,7 +2029,7 @@ index 1fda21d5..63a22864 100644
2086 fsub = llvm::UndefValue::get(Inst->getType()); 2029 fsub = llvm::UndefValue::get(Inst->getType());
2087 2030
2088 for (uint32_t i = 0; i < vectorSize; ++i) 2031 for (uint32_t i = 0; i < vectorSize; ++i)
2089@@ -936,7 +936,7 @@ void PreCompiledFuncImport::processDivide(BinaryOperator& inst, EmulatedFunction 2032@@ -1002,7 +1002,7 @@ void PreCompiledFuncImport::processDivide(BinaryOperator& inst, EmulatedFunction
2090 2033
2091 Type* argumentType = inst.getOperand(0)->getType(); 2034 Type* argumentType = inst.getOperand(0)->getType();
2092 2035
@@ -2096,10 +2039,10 @@ index 1fda21d5..63a22864 100644
2096 numElements = (unsigned)argumentVType->getNumElements(); 2039 numElements = (unsigned)argumentVType->getNumElements();
2097 } 2040 }
2098diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp 2041diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp
2099index 4f59eaf9..a4e73a6d 100644 2042index 740fb4d57..b98ba6693 100644
2100--- a/IGC/Compiler/Optimizer/Scalarizer.cpp 2043--- a/IGC/Compiler/Optimizer/Scalarizer.cpp
2101+++ b/IGC/Compiler/Optimizer/Scalarizer.cpp 2044+++ b/IGC/Compiler/Optimizer/Scalarizer.cpp
2102@@ -289,7 +289,7 @@ void ScalarizeFunction::scalarizeInstruction(BinaryOperator* BI) 2045@@ -403,7 +403,7 @@ void ScalarizeFunction::scalarizeInstruction(BinaryOperator* BI)
2103 { 2046 {
2104 V_PRINT(scalarizer, "\t\tBinary instruction\n"); 2047 V_PRINT(scalarizer, "\t\tBinary instruction\n");
2105 IGC_ASSERT_MESSAGE(BI, "instruction type dynamic cast failed"); 2048 IGC_ASSERT_MESSAGE(BI, "instruction type dynamic cast failed");
@@ -2108,7 +2051,7 @@ index 4f59eaf9..a4e73a6d 100644
2108 // Only need handling for vector binary ops 2051 // Only need handling for vector binary ops
2109 if (!instType) return; 2052 if (!instType) return;
2110 2053
2111@@ -349,7 +349,7 @@ void ScalarizeFunction::scalarizeInstruction(CmpInst* CI) 2054@@ -463,7 +463,7 @@ void ScalarizeFunction::scalarizeInstruction(CmpInst* CI)
2112 { 2055 {
2113 V_PRINT(scalarizer, "\t\tCompare instruction\n"); 2056 V_PRINT(scalarizer, "\t\tCompare instruction\n");
2114 IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed"); 2057 IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed");
@@ -2117,7 +2060,7 @@ index 4f59eaf9..a4e73a6d 100644
2117 // Only need handling for vector compares 2060 // Only need handling for vector compares
2118 if (!instType) return; 2061 if (!instType) return;
2119 2062
2120@@ -397,13 +397,13 @@ void ScalarizeFunction::scalarizeInstruction(CastInst* CI) 2063@@ -511,13 +511,13 @@ void ScalarizeFunction::scalarizeInstruction(CastInst* CI)
2121 { 2064 {
2122 V_PRINT(scalarizer, "\t\tCast instruction\n"); 2065 V_PRINT(scalarizer, "\t\tCast instruction\n");
2123 IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed"); 2066 IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed");
@@ -2133,7 +2076,7 @@ index 4f59eaf9..a4e73a6d 100644
2133 if (!srcType || (instType->getNumElements() != srcType->getNumElements())) 2076 if (!srcType || (instType->getNumElements() != srcType->getNumElements()))
2134 { 2077 {
2135 return recoverNonScalarizableInst(CI); 2078 return recoverNonScalarizableInst(CI);
2136@@ -458,7 +458,7 @@ void ScalarizeFunction::scalarizeInstruction(PHINode* PI) 2079@@ -572,7 +572,7 @@ void ScalarizeFunction::scalarizeInstruction(PHINode* PI)
2137 { 2080 {
2138 V_PRINT(scalarizer, "\t\tPHI instruction\n"); 2081 V_PRINT(scalarizer, "\t\tPHI instruction\n");
2139 IGC_ASSERT_MESSAGE(PI, "instruction type dynamic cast failed"); 2082 IGC_ASSERT_MESSAGE(PI, "instruction type dynamic cast failed");
@@ -2142,7 +2085,7 @@ index 4f59eaf9..a4e73a6d 100644
2142 // Only need handling for vector PHI 2085 // Only need handling for vector PHI
2143 if (!instType) return; 2086 if (!instType) return;
2144 2087
2145@@ -569,7 +569,7 @@ void ScalarizeFunction::scalarizeInstruction(SelectInst* SI) 2088@@ -683,7 +683,7 @@ void ScalarizeFunction::scalarizeInstruction(SelectInst* SI)
2146 { 2089 {
2147 V_PRINT(scalarizer, "\t\tSelect instruction\n"); 2090 V_PRINT(scalarizer, "\t\tSelect instruction\n");
2148 IGC_ASSERT_MESSAGE(SI, "instruction type dynamic cast failed"); 2091 IGC_ASSERT_MESSAGE(SI, "instruction type dynamic cast failed");
@@ -2151,7 +2094,7 @@ index 4f59eaf9..a4e73a6d 100644
2151 // Only need handling for vector select 2094 // Only need handling for vector select
2152 if (!instType) return; 2095 if (!instType) return;
2153 2096
2154@@ -651,7 +651,7 @@ void ScalarizeFunction::scalarizeInstruction(ExtractElementInst* EI) 2097@@ -765,7 +765,7 @@ void ScalarizeFunction::scalarizeInstruction(ExtractElementInst* EI)
2155 2098
2156 // Connect the "extracted" value to all its consumers 2099 // Connect the "extracted" value to all its consumers
2157 uint64_t scalarIndex = cast<ConstantInt>(scalarIndexVal)->getZExtValue(); 2100 uint64_t scalarIndex = cast<ConstantInt>(scalarIndexVal)->getZExtValue();
@@ -2160,7 +2103,7 @@ index 4f59eaf9..a4e73a6d 100644
2160 if (static_cast<unsigned int>(scalarIndex) < (unsigned)valueVType->getNumElements()) 2103 if (static_cast<unsigned int>(scalarIndex) < (unsigned)valueVType->getNumElements())
2161 { 2104 {
2162 IGC_ASSERT_MESSAGE(NULL != operand[static_cast<unsigned int>(scalarIndex)], "SCM error"); 2105 IGC_ASSERT_MESSAGE(NULL != operand[static_cast<unsigned int>(scalarIndex)], "SCM error");
2163@@ -715,7 +715,7 @@ void ScalarizeFunction::scalarizeInstruction(InsertElementInst* II) 2106@@ -829,7 +829,7 @@ void ScalarizeFunction::scalarizeInstruction(InsertElementInst* II)
2164 if (isa<UndefValue>(sourceVectorValue)) 2107 if (isa<UndefValue>(sourceVectorValue))
2165 { 2108 {
2166 // Scalarize the undef value (generate a scalar undef) 2109 // Scalarize the undef value (generate a scalar undef)
@@ -2169,7 +2112,7 @@ index 4f59eaf9..a4e73a6d 100644
2169 IGC_ASSERT_MESSAGE(inputVectorType, "expected vector argument"); 2112 IGC_ASSERT_MESSAGE(inputVectorType, "expected vector argument");
2170 2113
2171 UndefValue* undefVal = UndefValue::get(inputVectorType->getElementType()); 2114 UndefValue* undefVal = UndefValue::get(inputVectorType->getElementType());
2172@@ -756,7 +756,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI) 2115@@ -870,7 +870,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
2173 IGC_ASSERT(nullptr != sourceVector0Value); 2116 IGC_ASSERT(nullptr != sourceVector0Value);
2174 Value* sourceVector1Value = SI->getOperand(1); 2117 Value* sourceVector1Value = SI->getOperand(1);
2175 IGC_ASSERT(nullptr != sourceVector1Value); 2118 IGC_ASSERT(nullptr != sourceVector1Value);
@@ -2178,16 +2121,16 @@ index 4f59eaf9..a4e73a6d 100644
2178 IGC_ASSERT_MESSAGE(nullptr != inputType, "vector input error"); 2121 IGC_ASSERT_MESSAGE(nullptr != inputType, "vector input error");
2179 IGC_ASSERT_MESSAGE(inputType == sourceVector1Value->getType(), "vector input error"); 2122 IGC_ASSERT_MESSAGE(inputType == sourceVector1Value->getType(), "vector input error");
2180 unsigned sourceVectorWidth = int_cast<unsigned>(inputType->getNumElements()); 2123 unsigned sourceVectorWidth = int_cast<unsigned>(inputType->getNumElements());
2181@@ -778,7 +778,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI) 2124@@ -892,7 +892,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
2182 2125
2183 // Generate array for shuffled scalar values 2126 // Generate array for shuffled scalar values
2184 SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector; 2127 SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector;
2185- unsigned width = int_cast<unsigned>(SI->getType()->getNumElements()); 2128- unsigned width = int_cast<unsigned>(SI->getType()->getNumElements());
2186+ unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements()); 2129+ unsigned width = int_cast<unsigned>(cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
2187 2130
2188 // Generate undef value, which may be needed as some scalar elements 2131 // Generate undef value, which may be needed as some scalar elements
2189 UndefValue* undef = UndefValue::get(inputType->getElementType()); 2132 UndefValue* undef = UndefValue::get(inputType->getElementType());
2190@@ -847,7 +847,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI) 2133@@ -961,7 +961,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI)
2191 2134
2192 if (baseValue->getType()->isVectorTy()) 2135 if (baseValue->getType()->isVectorTy())
2193 { 2136 {
@@ -2196,7 +2139,7 @@ index 4f59eaf9..a4e73a6d 100644
2196 // Obtain the scalarized operands 2139 // Obtain the scalarized operands
2197 obtainScalarizedValues(operand1, NULL, baseValue, GI); 2140 obtainScalarizedValues(operand1, NULL, baseValue, GI);
2198 ptrTy = dyn_cast<VectorType>(baseValue->getType())->getElementType(); 2141 ptrTy = dyn_cast<VectorType>(baseValue->getType())->getElementType();
2199@@ -858,7 +858,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI) 2142@@ -972,7 +972,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI)
2200 } 2143 }
2201 if (indexValue->getType()->isVectorTy()) 2144 if (indexValue->getType()->isVectorTy())
2202 { 2145 {
@@ -2205,25 +2148,7 @@ index 4f59eaf9..a4e73a6d 100644
2205 // Obtain the scalarized operands 2148 // Obtain the scalarized operands
2206 obtainScalarizedValues(operand2, NULL, indexValue, GI); 2149 obtainScalarizedValues(operand2, NULL, indexValue, GI);
2207 } 2150 }
2208@@ -897,7 +897,7 @@ void ScalarizeFunction::scalarizeInstruction(LoadInst* LI) 2151@@ -1011,7 +1011,7 @@ void ScalarizeFunction::obtainScalarizedValues(SmallVectorImpl<Value*>& retValue
2209 V_PRINT(scalarizer, "\t\tLoad instruction\n");
2210 IGC_ASSERT_MESSAGE(LI, "instruction type dynamic cast failed");
2211
2212- VectorType* dataType = dyn_cast<VectorType>(LI->getType());
2213+ IGCLLVM::FixedVectorType* dataType = dyn_cast<IGCLLVM::FixedVectorType>(LI->getType());
2214 if (isScalarizableLoadStoreType(dataType) && m_pDL)
2215 {
2216 // Prepare empty SCM entry for the instruction
2217@@ -969,7 +969,7 @@ void ScalarizeFunction::scalarizeInstruction(StoreInst* SI)
2218
2219 int indexPtr = SI->getPointerOperandIndex();
2220 int indexData = 1 - indexPtr;
2221- VectorType* dataType = dyn_cast<VectorType>(SI->getOperand(indexData)->getType());
2222+ IGCLLVM::FixedVectorType* dataType = dyn_cast<IGCLLVM::FixedVectorType>(SI->getOperand(indexData)->getType());
2223 if (isScalarizableLoadStoreType(dataType) && m_pDL)
2224 {
2225 // Get additional info from instruction
2226@@ -1040,7 +1040,7 @@ void ScalarizeFunction::obtainScalarizedValues(SmallVectorImpl<Value*>& retValue
2227 { 2152 {
2228 V_PRINT(scalarizer, "\t\t\tObtaining scalar value... " << *origValue << "\n"); 2153 V_PRINT(scalarizer, "\t\t\tObtaining scalar value... " << *origValue << "\n");
2229 2154
@@ -2232,7 +2157,7 @@ index 4f59eaf9..a4e73a6d 100644
2232 IGC_ASSERT_MESSAGE(origType, "Value must have a vector type!"); 2157 IGC_ASSERT_MESSAGE(origType, "Value must have a vector type!");
2233 unsigned width = int_cast<unsigned>(origType->getNumElements()); 2158 unsigned width = int_cast<unsigned>(origType->getNumElements());
2234 2159
2235@@ -1202,7 +1202,7 @@ void ScalarizeFunction::obtainVectorValueWhichMightBeScalarizedImpl(Value* vecto 2160@@ -1170,7 +1170,7 @@ void ScalarizeFunction::obtainVectorValueWhichMightBeScalarizedImpl(Value* vecto
2236 } 2161 }
2237 2162
2238 Value* assembledVector = UndefValue::get(vectorVal->getType()); 2163 Value* assembledVector = UndefValue::get(vectorVal->getType());
@@ -2241,7 +2166,7 @@ index 4f59eaf9..a4e73a6d 100644
2241 for (unsigned i = 0; i < width; i++) 2166 for (unsigned i = 0; i < width; i++)
2242 { 2167 {
2243 IGC_ASSERT_MESSAGE(NULL != valueEntry->scalarValues[i], "SCM entry has NULL value"); 2168 IGC_ASSERT_MESSAGE(NULL != valueEntry->scalarValues[i], "SCM entry has NULL value");
2244@@ -1262,7 +1262,7 @@ void ScalarizeFunction::updateSCMEntryWithValues(ScalarizeFunction::SCMEntry* en 2169@@ -1230,7 +1230,7 @@ void ScalarizeFunction::updateSCMEntryWithValues(ScalarizeFunction::SCMEntry* en
2245 bool matchDbgLoc) 2170 bool matchDbgLoc)
2246 { 2171 {
2247 IGC_ASSERT_MESSAGE((origValue->getType()->isArrayTy() || origValue->getType()->isVectorTy()), "only Vector values are supported"); 2172 IGC_ASSERT_MESSAGE((origValue->getType()->isArrayTy() || origValue->getType()->isVectorTy()), "only Vector values are supported");
@@ -2250,7 +2175,7 @@ index 4f59eaf9..a4e73a6d 100644
2250 2175
2251 entry->isOriginalVectorRemoved = isOrigValueRemoved; 2176 entry->isOriginalVectorRemoved = isOrigValueRemoved;
2252 2177
2253@@ -1326,7 +1326,7 @@ void ScalarizeFunction::resolveDeferredInstructions() 2178@@ -1301,7 +1301,7 @@ void ScalarizeFunction::resolveDeferredInstructions()
2254 Instruction* vectorInst = dyn_cast<Instruction>(current.unresolvedInst); 2179 Instruction* vectorInst = dyn_cast<Instruction>(current.unresolvedInst);
2255 IGC_ASSERT_MESSAGE(vectorInst, "DRL only handles unresolved instructions"); 2180 IGC_ASSERT_MESSAGE(vectorInst, "DRL only handles unresolved instructions");
2256 2181
@@ -2260,10 +2185,10 @@ index 4f59eaf9..a4e73a6d 100644
2260 unsigned width = int_cast<unsigned>(currType->getNumElements()); 2185 unsigned width = int_cast<unsigned>(currType->getNumElements());
2261 2186
2262diff --git a/IGC/Compiler/Optimizer/ValueTracker.cpp b/IGC/Compiler/Optimizer/ValueTracker.cpp 2187diff --git a/IGC/Compiler/Optimizer/ValueTracker.cpp b/IGC/Compiler/Optimizer/ValueTracker.cpp
2263index c06f7312..d8f0d385 100644 2188index a2796daa5..a3d03d267 100644
2264--- a/IGC/Compiler/Optimizer/ValueTracker.cpp 2189--- a/IGC/Compiler/Optimizer/ValueTracker.cpp
2265+++ b/IGC/Compiler/Optimizer/ValueTracker.cpp 2190+++ b/IGC/Compiler/Optimizer/ValueTracker.cpp
2266@@ -178,7 +178,7 @@ Value* ValueTracker::handleExtractElement(ExtractElementInst* E) 2191@@ -162,7 +162,7 @@ Value* ValueTracker::handleExtractElement(ExtractElementInst* E)
2267 { 2192 {
2268 auto mask = I->getShuffleMask(); 2193 auto mask = I->getShuffleMask();
2269 uint shuffleidx = int_cast<uint>(mask[(uint)idx]); 2194 uint shuffleidx = int_cast<uint>(mask[(uint)idx]);
@@ -2273,10 +2198,10 @@ index c06f7312..d8f0d385 100644
2273 I->getOperand(0) : I->getOperand(1); 2198 I->getOperand(0) : I->getOperand(1);
2274 } 2199 }
2275diff --git a/IGC/Compiler/VerificationPass.cpp b/IGC/Compiler/VerificationPass.cpp 2200diff --git a/IGC/Compiler/VerificationPass.cpp b/IGC/Compiler/VerificationPass.cpp
2276index 98437d79..40d50f5a 100644 2201index 7a9d69bec..df73419c0 100644
2277--- a/IGC/Compiler/VerificationPass.cpp 2202--- a/IGC/Compiler/VerificationPass.cpp
2278+++ b/IGC/Compiler/VerificationPass.cpp 2203+++ b/IGC/Compiler/VerificationPass.cpp
2279@@ -302,7 +302,7 @@ bool VerificationPass::verifyType(Type* type, Value* val) 2204@@ -286,7 +286,7 @@ bool VerificationPass::verifyType(Type* type, Value* val)
2280 2205
2281 case IGCLLVM::VectorTyID: 2206 case IGCLLVM::VectorTyID:
2282 { 2207 {
@@ -2286,48 +2211,39 @@ index 98437d79..40d50f5a 100644
2286 if (!m_IGC_IR_spec.vectorTypeSizes.count(typeSize)) 2211 if (!m_IGC_IR_spec.vectorTypeSizes.count(typeSize))
2287 { 2212 {
2288diff --git a/IGC/DebugInfo/DebugInfoUtils.hpp b/IGC/DebugInfo/DebugInfoUtils.hpp 2213diff --git a/IGC/DebugInfo/DebugInfoUtils.hpp b/IGC/DebugInfo/DebugInfoUtils.hpp
2289index 7f2e288a..b77a550d 100644 2214index 28b7fcf73..d16d79a3d 100644
2290--- a/IGC/DebugInfo/DebugInfoUtils.hpp 2215--- a/IGC/DebugInfo/DebugInfoUtils.hpp
2291+++ b/IGC/DebugInfo/DebugInfoUtils.hpp 2216+++ b/IGC/DebugInfo/DebugInfoUtils.hpp
2292@@ -108,7 +108,11 @@ namespace IGC 2217@@ -92,7 +92,7 @@ namespace IGC
2293 IGCLLVM::DIBuilder Builder(M); 2218 IGCLLVM::DIBuilder Builder(M);
2294 llvm::DIGlobalVariable* GV = GVs[j]->getVariable(); 2219 llvm::DIGlobalVariable* GV = GVs[j]->getVariable();
2295 llvm::DIScope* scopeToUse = GV->getScope(); 2220 llvm::DIScope* scopeToUse = GV->getScope();
2296+#if LLVM_VERSION_MAJOR >= 12 2221- llvm::DILocation* locToUse = llvm::DebugLoc::get(GV->getLine(), 0, scopeToUse, loc);
2297+ llvm::DILocation* locToUse = llvm::DILocation::get(scopeToUse->getContext(), GV->getLine(), 0, scopeToUse, loc); 2222+ llvm::DILocation* locToUse = llvm::DILocation::get(scopeToUse->getContext(), GV->getLine(), 0, scopeToUse, loc);
2298+#else
2299 llvm::DILocation* locToUse = llvm::DebugLoc::get(GV->getLine(), 0, scopeToUse, loc);
2300+#endif
2301 if (llvm::isa<llvm::DICompileUnit>(GV->getScope())) 2223 if (llvm::isa<llvm::DICompileUnit>(GV->getScope()))
2302 { 2224 {
2303 // Function has no DebugLoc so it is either internal 2225 // Function has no DebugLoc so it is either internal
2304diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp 2226diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp
2305index 683b83f7..bd9f17b7 100644 2227index 027a3a530..f57dd72cb 100644
2306--- a/IGC/DebugInfo/DwarfDebug.cpp 2228--- a/IGC/DebugInfo/DwarfDebug.cpp
2307+++ b/IGC/DebugInfo/DwarfDebug.cpp 2229+++ b/IGC/DebugInfo/DwarfDebug.cpp
2308@@ -2102,9 +2102,17 @@ static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext& Ctx) 2230@@ -1993,9 +1993,9 @@ static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext& Ctx)
2309 // Check for number of operands since the compatibility is cheap here. 2231 // Check for number of operands since the compatibility is cheap here.
2310 if (SP->getNumOperands() > 19) 2232 if (SP->getNumOperands() > 19)
2311 { 2233 {
2312+#if LLVM_VERSION_MAJOR >= 12 2234- return DebugLoc::get(SP->getScopeLine(), 0, SP);
2313+ return DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP); 2235+ return DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP);
2314+#else
2315 return DebugLoc::get(SP->getScopeLine(), 0, SP);
2316+#endif
2317 } 2236 }
2318+#if LLVM_VERSION_MAJOR >= 12 2237- return DebugLoc::get(SP->getLine(), 0, SP);
2319+ return DILocation::get(SP->getContext(), SP->getLine(), 0, SP); 2238+ return DILocation::get(SP->getContext(), SP->getLine(), 0, SP);
2320+#else
2321 return DebugLoc::get(SP->getLine(), 0, SP);
2322+#endif
2323 } 2239 }
2324 2240
2325 return DebugLoc(); 2241 return DebugLoc();
2326diff --git a/IGC/GenISAIntrinsics/GenIntrinsics.cpp b/IGC/GenISAIntrinsics/GenIntrinsics.cpp 2242diff --git a/IGC/GenISAIntrinsics/GenIntrinsics.cpp b/IGC/GenISAIntrinsics/GenIntrinsics.cpp
2327index 708cfdaa..772155b2 100644 2243index a6d6f0ae6..c48271125 100644
2328--- a/IGC/GenISAIntrinsics/GenIntrinsics.cpp 2244--- a/IGC/GenISAIntrinsics/GenIntrinsics.cpp
2329+++ b/IGC/GenISAIntrinsics/GenIntrinsics.cpp 2245+++ b/IGC/GenISAIntrinsics/GenIntrinsics.cpp
2330@@ -204,7 +204,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos, 2246@@ -188,7 +188,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos,
2331 case IITDescriptor::SameVecWidthArgument: { 2247 case IITDescriptor::SameVecWidthArgument: {
2332 Type *EltTy = DecodeFixedType(Infos, Tys, Context); 2248 Type *EltTy = DecodeFixedType(Infos, Tys, Context);
2333 Type *Ty = Tys[D.getArgumentNumber()]; 2249 Type *Ty = Tys[D.getArgumentNumber()];
@@ -2336,7 +2252,7 @@ index 708cfdaa..772155b2 100644
2336 return IGCLLVM::FixedVectorType::get(EltTy, int_cast<unsigned int>(VTy->getNumElements())); 2252 return IGCLLVM::FixedVectorType::get(EltTy, int_cast<unsigned int>(VTy->getNumElements()));
2337 } 2253 }
2338 IGC_ASSERT_EXIT_MESSAGE(0, "unhandled"); 2254 IGC_ASSERT_EXIT_MESSAGE(0, "unhandled");
2339@@ -215,7 +215,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos, 2255@@ -199,7 +199,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos,
2340 } 2256 }
2341 case IITDescriptor::VecOfPtrsToElt: { 2257 case IITDescriptor::VecOfPtrsToElt: {
2342 Type *Ty = Tys[D.getArgumentNumber()]; 2258 Type *Ty = Tys[D.getArgumentNumber()];
@@ -2345,7 +2261,7 @@ index 708cfdaa..772155b2 100644
2345 if (!VTy) 2261 if (!VTy)
2346 IGC_ASSERT_EXIT_MESSAGE(0, "Expected an argument of Vector Type"); 2262 IGC_ASSERT_EXIT_MESSAGE(0, "Expected an argument of Vector Type");
2347 Type *EltTy = cast<VectorType>(VTy)->getElementType(); 2263 Type *EltTy = cast<VectorType>(VTy)->getElementType();
2348@@ -434,7 +434,7 @@ static std::string getMangledTypeStr(Type* Ty) { 2264@@ -418,7 +418,7 @@ static std::string getMangledTypeStr(Type* Ty) {
2349 Result += "f"; 2265 Result += "f";
2350 } 2266 }
2351 else if (isa<VectorType>(Ty)) 2267 else if (isa<VectorType>(Ty))
@@ -2355,10 +2271,10 @@ index 708cfdaa..772155b2 100644
2355 else if (Ty) 2271 else if (Ty)
2356 Result += EVT::getEVT(Ty).getEVTString(); 2272 Result += EVT::getEVT(Ty).getEVTString();
2357diff --git a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp 2273diff --git a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
2358index a89d63b9..a1bc5d2c 100644 2274index 2306c2357..b5f66f048 100644
2359--- a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp 2275--- a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
2360+++ b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp 2276+++ b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
2361@@ -4929,7 +4929,7 @@ void LLVM3DBuilder<preserveNames, T, Inserter>::VectorToScalars( 2277@@ -4993,7 +4993,7 @@ void LLVM3DBuilder<preserveNames, T, Inserter>::VectorToScalars(
2362 IGC_ASSERT(nullptr != vector->getType()); 2278 IGC_ASSERT(nullptr != vector->getType());
2363 IGC_ASSERT(vector->getType()->isVectorTy()); 2279 IGC_ASSERT(vector->getType()->isVectorTy());
2364 2280
@@ -2367,11 +2283,39 @@ index a89d63b9..a1bc5d2c 100644
2367 IGC_ASSERT(1 < count); 2283 IGC_ASSERT(1 < count);
2368 IGC_ASSERT(count <= 4); 2284 IGC_ASSERT(count <= 4);
2369 IGC_ASSERT(count <= maxSize); 2285 IGC_ASSERT(count <= maxSize);
2286diff --git a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
2287index 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
2370diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h 2314diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
2371index 08e5d6cf..30e29720 100644 2315index 19c5183eb..709f1bbbb 100644
2372--- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h 2316--- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
2373+++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h 2317+++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
2374@@ -35,10 +35,16 @@ using namespace llvm; 2318@@ -17,10 +17,14 @@ using namespace llvm;
2375 namespace IGCLLVM { 2319 namespace IGCLLVM {
2376 #if LLVM_VERSION_MAJOR < 11 2320 #if LLVM_VERSION_MAJOR < 11
2377 inline unsigned getElementCount(unsigned EC) { return EC; } 2321 inline unsigned getElementCount(unsigned EC) { return EC; }
@@ -2380,20 +2324,18 @@ index 08e5d6cf..30e29720 100644
2380 inline ElementCount getElementCount(unsigned EC) { 2324 inline ElementCount getElementCount(unsigned EC) {
2381 return ElementCount(EC, false); 2325 return ElementCount(EC, false);
2382 } 2326 }
2383+#elif LLVM_VERSION_MAJOR == 12 2327+#else
2384+inline ElementCount getElementCount(unsigned EC) { 2328+inline ElementCount getElementCount(unsigned EC) {
2385+ return ElementCount::get(EC, false); 2329+ return ElementCount::get(EC, false);
2386+} 2330+}
2387+#else
2388+#error "unsupported LLVM version"
2389 #endif 2331 #endif
2390 } // namespace IGCLLVM 2332 } // namespace IGCLLVM
2391 2333
2392diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h 2334diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
2393index f6e54fb1..5266ee87 100644 2335index 74841ddc1..1df041372 100644
2394--- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h 2336--- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
2395+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h 2337+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
2396@@ -44,7 +44,7 @@ namespace IGCLLVM 2338@@ -26,7 +26,7 @@ namespace IGCLLVM
2397 { 2339 {
2398 return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling); 2340 return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
2399 } 2341 }
@@ -2402,7 +2344,7 @@ index f6e54fb1..5266ee87 100644
2402 inline static llvm::Pass * createLoopUnrollPass( 2344 inline static llvm::Pass * createLoopUnrollPass(
2403 int OptLevel = 2, int Threshold = -1, int Count = -1, 2345 int OptLevel = 2, int Threshold = -1, int Count = -1,
2404 int AllowPartial = -1, int Runtime = -1, 2346 int AllowPartial = -1, int Runtime = -1,
2405@@ -52,7 +52,7 @@ namespace IGCLLVM 2347@@ -34,7 +34,7 @@ namespace IGCLLVM
2406 { 2348 {
2407 return llvm::createLoopUnrollPass(OptLevel, false, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling); 2349 return llvm::createLoopUnrollPass(OptLevel, false, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
2408 } 2350 }
@@ -2411,23 +2353,42 @@ index f6e54fb1..5266ee87 100644
2411 //DO NOT assume same function signature for all incoming llvm versions! Double check to upgrade! 2353 //DO NOT assume same function signature for all incoming llvm versions! Double check to upgrade!
2412 #error Not supported llvm version. 2354 #error Not supported llvm version.
2413 #endif 2355 #endif
2356diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
2357index 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
2414diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h 2375diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h
2415index 6831b06c..d790330f 100644 2376index a9a6a1871..713d6f4bb 100644
2416--- a/IGC/common/igc_resourceDimTypes.h 2377--- a/IGC/common/igc_resourceDimTypes.h
2417+++ b/IGC/common/igc_resourceDimTypes.h 2378+++ b/IGC/common/igc_resourceDimTypes.h
2418@@ -66,6 +66,11 @@ namespace IGC 2379@@ -50,6 +50,10 @@ namespace IGC
2419 resourceDimTypeId == DIM_2D_TYPE || resourceDimTypeId == DIM_2D_ARRAY_TYPE || 2380 resourceDimTypeId == DIM_2D_TYPE || resourceDimTypeId == DIM_2D_ARRAY_TYPE ||
2420 resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE)); 2381 resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE));
2421 2382
2422+#if LLVM_VERSION_MAJOR >= 12 2383+#if LLVM_VERSION_MAJOR >= 12
2423+ llvm::LLVMContext& llvmCtx = module.getContext(); 2384+ return llvm::StructType::getTypeByName(module.getContext(), ResourceDimensionTypeName[resourceDimTypeId]);
2424+ return llvm::StructType::getTypeByName(llvmCtx, ResourceDimensionTypeName[resourceDimTypeId]);
2425+#else 2385+#else
2426 return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]); 2386 return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]);
2427+#endif 2387+#endif
2428 } 2388 }
2429 } 2389-}
2430\ No newline at end of file 2390\ No newline at end of file
2391+}
2431-- 2392--
24322.17.1 23932.20.1
2433 2394
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/link-to-LLVMGenXIntrinsics.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/link-to-LLVMGenXIntrinsics.patch
deleted file mode 100644
index aead2d1c..00000000
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/link-to-LLVMGenXIntrinsics.patch
+++ /dev/null
@@ -1,71 +0,0 @@
1From 11b923c99cbe3580885ce40c322277fc823107a0 Mon Sep 17 00:00:00 2001
2From: Naveen Saini <naveen.kumar.saini@intel.com>
3Date: Tue, 2 Feb 2021 13:39:53 +0800
4Subject: [PATCH] IGC/VectorCompiler/CMakeLists.txt: link to external
5 LLVMGenXIntrinsics
6
7By default LLVMGenXIntrinsics is to be build In-tree, but we want to
8link externally.
9
10Fix llvm-tblgen path.
11
12Upstream-Status: Inappropriate [configuration specific]
13
14Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
15---
16 IGC/VectorCompiler/CMakeLists.txt | 32 ++-----------------------------
17 1 file changed, 2 insertions(+), 30 deletions(-)
18
19diff --git a/IGC/VectorCompiler/CMakeLists.txt b/IGC/VectorCompiler/CMakeLists.txt
20index 86f343ee..b4268160 100644
21--- a/IGC/VectorCompiler/CMakeLists.txt
22+++ b/IGC/VectorCompiler/CMakeLists.txt
23@@ -53,10 +53,7 @@ if(IGC_BUILD__USING_SYSTEM_LLVM OR (WIN32 AND LLVM_USE_PREBUILT))
24 message(STATUS "[VC] Using system llvm")
25
26 # Need to search for llvm-tblgen
27- find_program(LLVM_TABLEGEN_EXE "llvm-tblgen"
28- ${LLVM_TOOLS_BINARY_DIR}
29- NO_DEFAULT_PATH
30- )
31+ find_program(LLVM_TABLEGEN_EXE "llvm-tblgen")
32 if(LLVM_TABLEGEN_EXE-NOTFOUND)
33 message(FATAL_ERROR "[VC] llvm-tblgen is not found")
34 endif()
35@@ -140,32 +137,7 @@ if(LLVM_ON_WIN32)
36 add_compile_options(/wd4141)
37 endif()
38
39-if(DEFINED VC_INTRINSICS_SRC)
40- set(INTRSRC "${VC_INTRINSICS_SRC}/GenXIntrinsics")
41-endif()
42-
43-if(NOT DEFINED INTRSRC)
44- set(INTRSRC "${CMAKE_CURRENT_SOURCE_DIR}/../../../vc-intrinsics/GenXIntrinsics")
45-endif()
46-
47-message(STATUS "[VC] Using vc-intrinsics source from: ${INTRSRC}")
48-
49-# We are using prebuilt SPIRV and building intrinsics.
50-set(INTRBUILD "${CMAKE_CURRENT_BINARY_DIR}/intrbuild")
51-add_subdirectory(${INTRSRC} ${INTRBUILD})
52-# Make separate target for intrinstics headers.
53-# Ideally, this should be inside intrinsics, but
54-# this breaks in-tree build of intrinsics with LLVM.
55-add_library(VCIntrinsicsHeaders INTERFACE)
56-target_include_directories(VCIntrinsicsHeaders
57- INTERFACE
58- ${INTRSRC}/include
59- ${INTRBUILD}/include
60- )
61-add_dependencies(VCIntrinsicsHeaders
62- GenXIntrinsics
63- )
64-
65+find_package(LLVMGenXIntrinsics REQUIRED)
66 include(cmake/spirv.cmake)
67 include(${IGC_SOURCE_DIR}/cmake/utils.cmake)
68
69--
702.17.1
71
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.6646.bb b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.8365.bb
index d546dc22..153f4bb4 100644
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.6646.bb
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-graphics-compiler_1.0.8365.bb
@@ -5,19 +5,18 @@ hardware architecture."
5 5
6LICENSE = "MIT & BSD-3-Clause" 6LICENSE = "MIT & BSD-3-Clause"
7LIC_FILES_CHKSUM = "file://IGC/BiFModule/Implementation/ExternalLibraries/libclc/LICENSE.TXT;md5=311cfc1a5b54bab8ed34a0b5fba4373e \ 7LIC_FILES_CHKSUM = "file://IGC/BiFModule/Implementation/ExternalLibraries/libclc/LICENSE.TXT;md5=311cfc1a5b54bab8ed34a0b5fba4373e \
8 file://IGC/Compiler/LegalizationPass.cpp;beginline=1;endline=23;md5=8b19c5999abc484f18232b0905367f9f \ 8 file://IGC/Compiler/LegalizationPass.cpp;beginline=1;endline=23;md5=4a985f2545dd5a846e205b1e60a51cd9 \
9 file://NOTICES.txt;md5=b12e73994de4fbe0f688cf0bc91512a0" 9 file://NOTICES.txt;md5=db621145dfb627436bc90ad600386801"
10 10
11SRC_URI = "git://github.com/intel/intel-graphics-compiler.git;protocol=https; \ 11SRC_URI = "git://github.com/intel/intel-graphics-compiler.git;protocol=https; \
12 file://0001-skip-execution-of-ElfPackager.patch \ 12 file://0001-skip-execution-of-ElfPackager.patch \
13 file://link-to-LLVMGenXIntrinsics.patch \ 13 file://0002-IGC-VectorCompiler-CMakeLists.txt-link-to-external-L.patch \
14 file://improve_src_package_reproducibility.patch \ 14 file://0003-Improve-Reproducibility-for-src-package.patch \
15 file://0001-Fix-build-with-LLVM-12.patch \ 15 file://0004-find-external-llvm-tblgen.patch \
16 file://0002-Review-fixes-for-LLVM-12-phase-1.patch \ 16 file://0005-Temporary-LLVM-12-compatiblity-fix.patch \
17 file://0003-Review-fixes-for-LLVM-12-phase-2.patch \
18 " 17 "
19 18
20SRCREV = "535aaaef03ce338e05e6162118082e6e007e8c10" 19SRCREV = "5d5672d6cc0c415dae76648390026f777004bd99"
21 20
22# Used to replace with relative path in reproducibility patch 21# Used to replace with relative path in reproducibility patch
23export B 22export B