]> git.pld-linux.org Git - packages/intel-graphics-compiler.git/blob - llvm12.patch
- fix building with LLVM 12
[packages/intel-graphics-compiler.git] / llvm12.patch
1 From 1c28c742daac3e2d2a3188716d913dd515f18acb Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
3  <zboszor@gmail.com>
4 Date: Mon, 26 Apr 2021 11:10:59 +0000
5 Subject: [PATCH] Fix build with LLVM 12
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Removed TargetLibraryInfo.h include from AddressSpaceAliasAnalysis.cpp
11 as this was causing treat-warning-as-error buildbreak,
12 Added casts to fix warnings,
13 Replaced ConstantPropagation and IPConstantPropagation passes with
14 IPSCCP passes,
15 reasoning here:
16 https://lists.llvm.org/pipermail/llvm-dev/2020-July/143788.html
17
18 Original pull-request:
19 intel/intel-graphics-compiler#171
20
21 Signed-off-by: Zoltán Böszörményi zboszor@gmail.com
22 Co-authored-by: Pawel Szymichowski pawel.szymichowski@intel.com
23
24 Co-authored-by: Zoltán Böszörményi zboszor@pr.hu
25 ---
26  .../LegalizeFunctionSignatures.cpp            |  2 +-
27  IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp          | 22 ++++++------
28  IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp            |  4 +--
29  IGC/Compiler/CISACodeGen/AdvMemOpt.cpp        |  3 +-
30  IGC/Compiler/CISACodeGen/CShader.cpp          | 12 +++----
31  .../CISACodeGen/ConstantCoalescing.cpp        | 14 ++++----
32  IGC/Compiler/CISACodeGen/DeSSA.cpp            |  3 +-
33  IGC/Compiler/CISACodeGen/EmitVISAPass.cpp     | 35 ++++++++++---------
34  IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp     |  4 +--
35  IGC/Compiler/CISACodeGen/GenIRLowering.cpp    |  4 +--
36  .../CISACodeGen/GenSimplification.cpp         |  5 +--
37  .../CISACodeGen/GeometryShaderLowering.cpp    |  3 +-
38  IGC/Compiler/CISACodeGen/LdShrink.cpp         | 10 ++++--
39  .../CISACodeGen/LowerGEPForPrivMem.cpp        |  8 ++---
40  IGC/Compiler/CISACodeGen/MemOpt.cpp           |  8 ++---
41  IGC/Compiler/CISACodeGen/MemOpt2.cpp          |  5 +--
42  .../CISACodeGen/OpenCLKernelCodeGen.cpp       |  2 +-
43  IGC/Compiler/CISACodeGen/PatternMatchPass.cpp |  4 +--
44  IGC/Compiler/CISACodeGen/PushAnalysis.cpp     |  4 +--
45  .../CISACodeGen/RegisterEstimator.cpp         |  3 +-
46  .../CISACodeGen/RegisterPressureEstimate.hpp  |  3 +-
47  IGC/Compiler/CISACodeGen/SLMConstProp.cpp     |  3 +-
48  .../CISACodeGen/ScalarizerCodeGen.cpp         |  4 +--
49  IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp    | 10 ++++++
50  .../CISACodeGen/Simd32Profitability.cpp       | 10 +++---
51  IGC/Compiler/CISACodeGen/SimplifyConstant.cpp | 12 +++----
52  IGC/Compiler/CISACodeGen/TypeDemote.cpp       |  3 +-
53  .../CISACodeGen/VariableReuseAnalysis.cpp     |  5 +--
54  .../CISACodeGen/VariableReuseAnalysis.hpp     |  3 +-
55  IGC/Compiler/CISACodeGen/VectorPreProcess.cpp | 24 ++++++-------
56  IGC/Compiler/CISACodeGen/VectorProcess.cpp    |  4 +--
57  IGC/Compiler/CISACodeGen/helper.cpp           | 10 +++---
58  IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp    | 10 +++---
59  IGC/Compiler/CustomSafeOptPass.cpp            | 26 +++++++-------
60  IGC/Compiler/DebugInfo/ScalarVISAModule.cpp   |  3 +-
61  IGC/Compiler/GenTTI.cpp                       |  3 +-
62  IGC/Compiler/GenUpdateCB.cpp                  |  3 +-
63  IGC/Compiler/HandleFRemInstructions.cpp       |  3 +-
64  IGC/Compiler/HandleLoadStoreInstructions.cpp  |  4 +--
65  IGC/Compiler/LegalizationPass.cpp             | 28 +++++++--------
66  IGC/Compiler/Legalizer/InstPromoter.cpp       |  5 +--
67  IGC/Compiler/Legalizer/InstScalarizer.cpp     |  6 ++--
68  .../Legalizer/PeepholeTypeLegalizer.cpp       |  6 ++--
69  IGC/Compiler/Legalizer/TypeLegalizer.cpp      |  3 +-
70  IGC/Compiler/Legalizer/TypeLegalizer.h        |  3 +-
71  IGC/Compiler/LowPrecisionOptPass.cpp          |  2 +-
72  .../AggregateArguments/AggregateArguments.cpp |  3 +-
73  .../CorrectlyRoundedDivSqrt.cpp               |  3 +-
74  .../DeviceEnqueueFuncs/TransformBlocks.cpp    |  4 +--
75  .../Optimizer/OpenCLPasses/KernelArgs.cpp     |  3 +-
76  .../OpenCLPrintf/OpenCLPrintfResolution.cpp   |  4 +--
77  .../PrivateMemory/PrivateMemoryResolution.cpp |  9 +++--
78  .../ReplaceUnsupportedIntrinsics.cpp          |  4 +--
79  .../OpenCLPasses/WIFuncs/WIFuncResolution.cpp |  2 +-
80  .../Optimizer/PreCompiledFuncImport.cpp       |  4 +--
81  IGC/Compiler/Optimizer/Scalarizer.cpp         | 32 ++++++++---------
82  IGC/Compiler/Optimizer/ValueTracker.cpp       |  2 +-
83  IGC/Compiler/VerificationPass.cpp             |  2 +-
84  IGC/DebugInfo/DebugInfoUtils.hpp              |  2 +-
85  IGC/DebugInfo/DwarfDebug.cpp                  |  4 +--
86  IGC/GenISAIntrinsics/GenIntrinsics.cpp        |  6 ++--
87  .../BuiltinsFrontendDefinitions.hpp           |  2 +-
88  .../include/llvmWrapper/IR/DerivedTypes.h     | 10 ++++++
89  .../include/llvmWrapper/Support/TypeSize.h    |  6 +++-
90  .../include/llvmWrapper/Transforms/Scalar.h   |  4 +--
91  .../llvmWrapper/Transforms/Utils/LoopUtils.h  |  8 +++++
92  IGC/common/igc_resourceDimTypes.h             |  5 +++
93  67 files changed, 269 insertions(+), 201 deletions(-)
94
95 diff --git a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
96 index 767f6b462b..fe0d578b9e 100644
97 --- a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
98 +++ b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp
99 @@ -140,7 +140,7 @@ inline Type* LegalizedIntVectorType(Module& M, const Type* const oldTy)
100      else if (size <= 64) newSize = 64;
101      else IGC_ASSERT_MESSAGE(0, "Currently don't support upscaling int sizes > 64 bits");
102  
103 -    return IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<VectorType>(oldTy)->getNumElements());
104 +    return IGCLLVM::FixedVectorType::get(IntegerType::get(M.getContext(), newSize), (unsigned)cast<IGCLLVM::FixedVectorType>(oldTy)->getNumElements());
105  }
106  
107  void LegalizeFunctionSignatures::FixFunctionSignatures()
108 diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
109 index fbdb12333b..c334ee3c50 100644
110 --- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
111 +++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp
112 @@ -1577,7 +1577,7 @@ void SPIRVToLLVMDbgTran::transDbgInfo(SPIRVValue *SV, Value *V) {
113              Line->getColumn(), scope, iat);
114  
115          if(scope && !isa<DIFile>(scope))
116 -            I->setDebugLoc(DebugLoc::get(Line->getLine(), Line->getColumn(),
117 +            I->setDebugLoc(DILocation::get(scope->getContext(), Line->getLine(), Line->getColumn(),
118                  scope, iat));
119      }
120  }
121 @@ -1929,7 +1929,7 @@ SPIRVToLLVM::transType(SPIRVType *T) {
122          auto name = isSubgroupAvcINTELTypeOpCode(OC) ?
123              OCLSubgroupINTELTypeOpCodeMap::rmap(OC) :
124              BuiltinOpaqueGenericTypeOpCodeMap::rmap(OC);
125 -        auto *pST = M->getTypeByName(name);
126 +        auto *pST = IGCLLVM::getTypeByName(M, name);
127          pST = pST ? pST : StructType::create(*Context, name);
128  
129          return mapType(T, PointerType::get(pST, getOCLOpaqueTypeAddrSpace(OC)));
130 @@ -2407,7 +2407,7 @@ Value *SPIRVToLLVM::promoteBool(Value *pVal, BasicBlock *BB)
131  
132      auto *PromoType = isa<VectorType>(pVal->getType()) ?
133          cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt8Ty(pVal->getContext()),
134 -        (unsigned)cast<VectorType>(pVal->getType())->getNumElements())) :
135 +        (unsigned)cast<IGCLLVM::FixedVectorType>(pVal->getType())->getNumElements())) :
136          Type::getInt8Ty(pVal->getContext());
137  
138      if (auto *C = dyn_cast<Constant>(pVal))
139 @@ -2449,7 +2449,7 @@ Value *SPIRVToLLVM::truncBool(Value *pVal, BasicBlock *BB)
140  
141      auto *TruncType = isa<VectorType>(pVal->getType()) ?
142          cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(pVal->getContext()),
143 -            (unsigned)cast<VectorType>(pVal->getType())->getNumElements())) :
144 +            (unsigned)cast<IGCLLVM::FixedVectorType>(pVal->getType())->getNumElements())) :
145          Type::getInt1Ty(pVal->getContext());
146  
147      if (auto *C = dyn_cast<Constant>(pVal))
148 @@ -2495,7 +2495,7 @@ Type *SPIRVToLLVM::truncBoolType(SPIRVType *SPVType, Type *LLType)
149  
150      return isa<VectorType>(LLType) ?
151          cast<Type>(IGCLLVM::FixedVectorType::get(Type::getInt1Ty(LLType->getContext()),
152 -                                   (unsigned)cast<VectorType>(LLType)->getNumElements())) :
153 +                                   (unsigned)cast<IGCLLVM::FixedVectorType>(LLType)->getNumElements())) :
154          Type::getInt1Ty(LLType->getContext());
155  }
156  
157 @@ -2652,7 +2652,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
158        {
159          if(CV[i]->getType()->isVectorTy())
160          {
161 -          for(uint32_t j = 0; j < cast<VectorType>(CV[i]->getType())->getNumElements(); j++)
162 +          for(uint32_t j = 0; j < cast<IGCLLVM::FixedVectorType>(CV[i]->getType())->getNumElements(); j++)
163            {
164              Value *v = ExtractElementInst::Create( CV[i],ConstantInt::get( *Context,APInt( 32,j ) ),BCC->getName(),BB );
165              elm1 = CreateCompositeConstruct( elm1,v,pos++ );
166 @@ -3346,7 +3346,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
167        auto Vector = transValue(BI->getOperand(0), F, BB);
168        auto Scalar = transValue(BI->getOperand(1), F, BB);
169  
170 -      auto VecType = cast<VectorType>(Vector->getType());
171 +      auto VecType = cast<IGCLLVM::FixedVectorType>(Vector->getType());
172        auto Undef   = UndefValue::get(VecType);
173  
174        auto ScalarVec = InsertElementInst::Create(Undef, Scalar,
175 @@ -3371,7 +3371,7 @@ SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
176            a->getType()->getScalarSizeInBits() - 1);
177        auto *ShiftOp = isa<VectorType>(a->getType()) ?
178            ConstantVector::getSplat(
179 -              IGCLLVM::getElementCount((unsigned)cast<VectorType>(a->getType())->getNumElements()), ShiftAmt) :
180 +              IGCLLVM::getElementCount((unsigned)cast<IGCLLVM::FixedVectorType>(a->getType())->getNumElements()), ShiftAmt) :
181            ShiftAmt;
182  
183        // OCL C:
184 @@ -3715,15 +3715,15 @@ SPIRVToLLVM::transSPIRVBuiltinFromInst(SPIRVInstruction *BI, BasicBlock *BB) {
185                "",
186                BB);
187        }
188 -      else if (cast<VectorType>(coordType)->getNumElements() != 4)
189 +      else if (cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements() != 4)
190        {
191            Value *undef = UndefValue::get(coordType);
192  
193            SmallVector<Constant*, 4> shuffleIdx;
194 -          for (unsigned i = 0; i < cast<VectorType>(coordType)->getNumElements(); i++)
195 +          for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements(); i++)
196                shuffleIdx.push_back(ConstantInt::get(Type::getInt32Ty(*Context), i));
197  
198 -          for (uint64_t i = (unsigned)cast<VectorType>(coordType)->getNumElements(); i < 4; i++)
199 +          for (uint64_t i = (unsigned)cast<IGCLLVM::FixedVectorType>(coordType)->getNumElements(); i < 4; i++)
200                shuffleIdx.push_back(ConstantInt::get(Type::getInt32Ty(*Context), 0));
201  
202            imageCoordinateWiden = new ShuffleVectorInst(
203 diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
204 index 57821556d3..f4f0dee5af 100644
205 --- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
206 +++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp
207 @@ -93,7 +93,7 @@ saveLLVMModule(Module *M, const std::string &OutputFile) {
208  PointerType*
209  getOrCreateOpaquePtrType(Module *M, const std::string &Name,
210      unsigned AddrSpace) {
211 -  auto OpaqueType = M->getTypeByName(Name);
212 +  auto OpaqueType = IGCLLVM::getTypeByName(M, Name);
213    if (!OpaqueType)
214      OpaqueType = StructType::create(M->getContext(), Name);
215    return PointerType::get(OpaqueType, AddrSpace);
216 @@ -159,7 +159,7 @@ std::string recursive_mangle(const Type* pType)
217              return "i" + utostr(pType->getIntegerBitWidth());
218          case IGCLLVM::VectorTyID:
219          {
220 -            unsigned vecLen = (unsigned)cast<VectorType>(pType)->getNumElements();
221 +            unsigned vecLen = (unsigned)cast<IGCLLVM::FixedVectorType>(pType)->getNumElements();
222              Type* pEltType = cast<VectorType>(pType)->getElementType();
223              return "v" + utostr(vecLen) + recursive_mangle(pEltType);
224          }
225 diff --git a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
226 index 81acc6ce6a..a612a4739a 100644
227 --- a/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
228 +++ b/IGC/Compiler/CISACodeGen/AdvMemOpt.cpp
229 @@ -33,6 +33,7 @@ IN THE SOFTWARE.
230  #include <llvm/Support/Debug.h>
231  #include <llvm/Support/raw_ostream.h>
232  #include <llvm/Transforms/Utils/Local.h>
233 +#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
234  #include "common/LLVMWarningsPop.hpp"
235  #include "GenISAIntrinsics/GenIntrinsics.h"
236  #include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
237 @@ -134,7 +135,7 @@ bool AdvMemOpt::runOnFunction(Function& F) {
238      for (auto I = LI->begin(), E = LI->end(); I != E; ++I)
239          for (auto DFI = df_begin(*I), DFE = df_end(*I); DFI != DFE; ++DFI) {
240              Loop* L = *DFI;
241 -            if (L->empty())
242 +            if (IGCLLVM::isInnermost(L))
243                  InnermostLoops.push_back(L);
244          }
245  
246 diff --git a/IGC/Compiler/CISACodeGen/CShader.cpp b/IGC/Compiler/CISACodeGen/CShader.cpp
247 index 86b7bfe663..e55a36ef9f 100644
248 --- a/IGC/Compiler/CISACodeGen/CShader.cpp
249 +++ b/IGC/Compiler/CISACodeGen/CShader.cpp
250 @@ -434,7 +434,7 @@ void CShader::CreateAliasVars()
251                          continue;
252  
253                      Type* Ty = V->getType();
254 -                    VectorType* VTy = dyn_cast<VectorType>(Ty);
255 +                    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
256                      Type* BTy = VTy ? VTy->getElementType() : Ty;
257                      int nelts = (VTy ? (int)VTy->getNumElements() : 1);
258  
259 @@ -984,7 +984,7 @@ bool CShader::InsideDivergentCF(llvm::Instruction* inst)
260  uint CShader::GetNbVectorElementAndMask(llvm::Value* val, uint32_t& mask)
261  {
262      llvm::Type* type = val->getType();
263 -    uint nbElement = int_cast<uint>(cast<VectorType>(type)->getNumElements());
264 +    uint nbElement = int_cast<uint>(cast<IGCLLVM::FixedVectorType>(type)->getNumElements());
265      mask = 0;
266      // we don't process vector bigger than 31 elements as the mask has only 32bits
267      // If we want to support longer vectors we need to extend the mask size
268 @@ -1189,7 +1189,7 @@ uint32_t CShader::GetExtractMask(llvm::Value* vecVal)
269      {
270          return it->second;
271      }
272 -    const unsigned int numChannels = vecVal->getType()->isVectorTy() ? (unsigned)cast<VectorType>(vecVal->getType())->getNumElements() : 1;
273 +    const unsigned int numChannels = vecVal->getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(vecVal->getType())->getNumElements() : 1;
274      IGC_ASSERT_MESSAGE(numChannels <= 32, "Mask has 32 bits maximally!");
275      return (1ULL << numChannels) - 1;
276  }
277 @@ -1197,7 +1197,7 @@ uint32_t CShader::GetExtractMask(llvm::Value* vecVal)
278  uint16_t CShader::AdjustExtractIndex(llvm::Value* vecVal, uint16_t index)
279  {
280      uint16_t result = index;
281 -    if (cast<VectorType>(vecVal->getType())->getNumElements() < 32)
282 +    if (cast<IGCLLVM::FixedVectorType>(vecVal->getType())->getNumElements() < 32)
283      {
284          uint32_t mask = GetExtractMask(vecVal);
285          for (uint i = 0; i < index; ++i)
286 @@ -1614,7 +1614,7 @@ auto sizeToSIMDMode = [](uint32_t size)
287  
288  CVariable* CShader::GetConstant(llvm::Constant* C, CVariable* dstVar)
289  {
290 -    llvm::VectorType* VTy = llvm::dyn_cast<llvm::VectorType>(C->getType());
291 +    IGCLLVM::FixedVectorType* VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(C->getType());
292      if (C && VTy)
293      {   // Vector constant
294          llvm::Type* eTy = VTy->getElementType();
295 @@ -1839,7 +1839,7 @@ uint32_t CShader::GetNumElts(llvm::Type* type, bool isUniform)
296      {
297          IGC_ASSERT(type->getContainedType(0)->isIntegerTy() || type->getContainedType(0)->isFloatingPointTy());
298  
299 -        auto VT = cast<VectorType>(type);
300 +        auto VT = cast<IGCLLVM::FixedVectorType>(type);
301          numElts *= (uint16_t)VT->getNumElements();
302      }
303      return numElts;
304 diff --git a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
305 index 9a7b61834e..a9b75bc2f5 100644
306 --- a/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
307 +++ b/IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp
308 @@ -224,7 +224,7 @@ static void checkInsertExtractMatch(InsertElementInst* insertInst, Value* base,
309  
310  static bool canReplaceInsert(InsertElementInst* insertElt)
311  {
312 -    VectorType* VTy = cast<VectorType>(insertElt->getOperand(0)->getType());
313 +    IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(insertElt->getOperand(0)->getType());
314      ConstantInt* index = dyn_cast<ConstantInt>(insertElt->getOperand(2));
315      if (!index || index->getZExtValue() != VTy->getNumElements() - 1)
316      {
317 @@ -312,7 +312,7 @@ void ConstantCoalescing::VectorizePrep(llvm::BasicBlock* bb)
318          {
319              if (load->getType()->isVectorTy() && wiAns->isUniform(load))
320              {
321 -                srcNElts = (uint32_t)cast<VectorType>(load->getType())->getNumElements();
322 +                srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(load->getType())->getNumElements();
323                  DenseMap<uint64_t, Instruction*> extractElementMap;
324  
325                  for (auto iter = load->user_begin(); iter != load->user_end(); iter++)
326 @@ -396,7 +396,7 @@ bool ConstantCoalescing::isProfitableLoad(
327              (isa<LoadInst>(I) && wiAns->isUniform(I)) ?
328              16 : 4;
329  
330 -        if (cast<VectorType>(LoadTy)->getNumElements() > MaxVectorInput)
331 +        if (cast<IGCLLVM::FixedVectorType>(LoadTy)->getNumElements() > MaxVectorInput)
332              return false;
333  
334          MaxEltPlus = CheckVectorElementUses(I);
335 @@ -1843,7 +1843,7 @@ void ConstantCoalescing::AdjustChunk(BufChunk* cov_chunk, uint start_adj, uint s
336          WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO);
337          irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode());
338          Value* vec = UndefValue::get(originalType);
339 -        for (unsigned i = 0; i < cast<VectorType>(originalType)->getNumElements(); i++)
340 +        for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(originalType)->getNumElements(); i++)
341          {
342              Value* channel = irBuilder->CreateExtractElement(
343                  cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj));
344 @@ -1907,7 +1907,7 @@ void ConstantCoalescing::MoveExtracts(BufChunk* cov_chunk, Instruction* load, ui
345              irBuilder->SetInsertPoint(load->getNextNode());
346              Type* vecType = load->getType();
347              Value* vec = UndefValue::get(vecType);
348 -            for (unsigned i = 0; i < cast<VectorType>(vecType)->getNumElements(); i++)
349 +            for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(vecType)->getNumElements(); i++)
350              {
351                  Value* channel = irBuilder->CreateExtractElement(
352                      cov_chunk->chunkIO, irBuilder->getInt32(i + start_adj));
353 @@ -1971,7 +1971,7 @@ void ConstantCoalescing::EnlargeChunk(BufChunk* cov_chunk, uint size_adj)
354          WIAnalysis::WIDependancy loadDep = wiAns->whichDepend(cov_chunk->chunkIO);
355          irBuilder->SetInsertPoint(cov_chunk->chunkIO->getNextNode());
356          Value* vec = UndefValue::get(originalType);
357 -        for (unsigned i = 0; i < cast<VectorType>(originalType)->getNumElements(); i++)
358 +        for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(originalType)->getNumElements(); i++)
359          {
360              Value* channel = irBuilder->CreateExtractElement(
361                  cov_chunk->chunkIO, irBuilder->getInt32(i));
362 @@ -2408,7 +2408,7 @@ void ConstantCoalescing::ReplaceLoadWithSamplerLoad(
363          if (dstTy->isVectorTy())
364          {
365              result = UndefValue::get(dstTy);
366 -            for (uint i = 0; i < cast<VectorType>(dstTy)->getNumElements(); i++)
367 +            for (uint i = 0; i < cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements(); i++)
368              {
369                  Value* tmpData = ExtractFromSamplerData(cast<VectorType>(dstTy)->getElementType(), i);
370                  result = irBuilder->CreateInsertElement(result, tmpData, irBuilder->getInt32(i));
371 diff --git a/IGC/Compiler/CISACodeGen/DeSSA.cpp b/IGC/Compiler/CISACodeGen/DeSSA.cpp
372 index b5d718cc6e..ce89fa53dd 100644
373 --- a/IGC/Compiler/CISACodeGen/DeSSA.cpp
374 +++ b/IGC/Compiler/CISACodeGen/DeSSA.cpp
375 @@ -85,6 +85,7 @@ IN THE SOFTWARE.
376  #include "llvmWrapper/IR/Instructions.h"
377  #include <llvm/IR/InstIterator.h>
378  #include <llvm/IR/InlineAsm.h>
379 +#include <llvmWrapper/IR/DerivedTypes.h>
380  #include "common/LLVMWarningsPop.hpp"
381  #include <algorithm>
382  #include "Probe/Assertion.h"
383 @@ -1319,7 +1320,7 @@ int DeSSA::checkInsertElementAlias(
384      //
385      // If found, return the actual vector size;
386      // otherwise, return 0.
387 -    VectorType* VTy = cast<VectorType>(IEI->getType());
388 +    IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(IEI->getType());
389      IGC_ASSERT(nullptr != VTy);
390      int nelts = (int)VTy->getNumElements();
391      AllIEIs.resize(nelts, nullptr);
392 diff --git a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
393 index c68692f74e..318d290d81 100644
394 --- a/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
395 +++ b/IGC/Compiler/CISACodeGen/EmitVISAPass.cpp
396 @@ -53,6 +53,7 @@ IN THE SOFTWARE.
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 "llvm/Support/FormattedStream.h"
403  #include "llvm/IR/AssemblyAnnotationWriter.h"
404 @@ -1229,7 +1230,7 @@ bool EmitPass::canRelocatePhiMov(
405                  if (dst != src)
406                  {
407                      int numElt = 1;
408 -                    if (VectorType * vTy = dyn_cast<VectorType>(PN->getType()))
409 +                    if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(PN->getType()))
410                      {
411                          numElt = int_cast<int>(vTy->getNumElements());
412                      }
413 @@ -1366,7 +1367,7 @@ void EmitPass::MovPhiSources(llvm::BasicBlock* aBB)
414                          phiSrcDstList.push_back(phiInfo);
415  
416                          int numElt = 0;
417 -                        if (VectorType * vTy = dyn_cast<VectorType>(PN->getType()))
418 +                        if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(PN->getType()))
419                          {
420                              numElt = int_cast<int>(vTy->getNumElements());
421                          }
422 @@ -5455,7 +5456,7 @@ void EmitPass::emitLegacySimdBlockWrite(llvm::Instruction* inst, llvm::Value* pt
423      bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext());
424  
425      Type* Ty = dataPtr->getType();
426 -    VectorType* VTy = dyn_cast<VectorType>(Ty);
427 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
428      uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
429  
430      uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8;
431 @@ -5701,7 +5702,7 @@ void EmitPass::emitLegacySimdBlockRead(llvm::Instruction* inst, llvm::Value* ptr
432      bool useA64 = isA64Ptr(ptrType, m_currShader->GetContext());
433  
434      Type* Ty = inst->getType();
435 -    VectorType* VTy = dyn_cast<VectorType>(Ty);
436 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
437      uint32_t nbElements = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
438  
439      uint32_t typeSizeInBytes = Ty->getScalarSizeInBits() / 8;
440 @@ -5993,7 +5994,7 @@ void EmitPass::emitMediaBlockIO(const llvm::GenIntrinsicInst* inst, bool isRead)
441          };
442  
443          uint nElts = isa<VectorType>(pDataType) ?
444 -            (uint)cast<VectorType>(pDataType)->getNumElements() :
445 +            (uint)cast<IGCLLVM::FixedVectorType>(pDataType)->getNumElements() :
446              1;
447  
448          // Now, do the copies.
449 @@ -6083,7 +6084,7 @@ void EmitPass::emitSimdMediaBlockRead(llvm::Instruction* inst)
450      uint32_t nbElements = 1;
451      if (inst->getType()->isVectorTy())
452      {
453 -        nbElements = (uint32_t)cast<VectorType>(inst->getType())->getNumElements();
454 +        nbElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements();
455      }
456      IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size");
457  
458 @@ -6327,7 +6328,7 @@ void EmitPass::emitSimdMediaBlockWrite(llvm::Instruction* inst)
459      uint32_t nbElements = 1;
460      if (dataPtr->getType()->isVectorTy())
461      {
462 -        nbElements = (uint32_t)cast<VectorType>(dataPtr->getType())->getNumElements();
463 +        nbElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(dataPtr->getType())->getNumElements();
464      }
465      IGC_ASSERT_MESSAGE(nbElements <= 8, "InValid Vector Size");
466  
467 @@ -9139,8 +9140,8 @@ void EmitPass::emitBitCast(llvm::BitCastInst* btCst)
468  {
469      Type* srcType = btCst->getOperand(0)->getType();
470      Type* dstType = btCst->getType();
471 -    unsigned int numSrcElement = srcType->isVectorTy() ? (unsigned)cast<VectorType>(srcType)->getNumElements() : 1;
472 -    unsigned int numDstElement = dstType->isVectorTy() ? (unsigned)cast<VectorType>(dstType)->getNumElements() : 1;
473 +    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;
475  
476      if (srcType->isPointerTy())
477      {
478 @@ -9587,7 +9588,7 @@ void EmitPass::emitLoad3DInner(LdRawIntrinsic* inst, ResourceDescriptor& resourc
479      {
480          IGC_ASSERT_MESSAGE(predDefSurface != ESURFACE_STATELESS, "scratch cannot be uniform");
481          Type* loadType = inst->getType();
482 -        uint numElement = loadType->isVectorTy() ? (uint)cast<VectorType>(loadType)->getNumElements() : 1;
483 +        uint numElement = loadType->isVectorTy() ? (uint)cast<IGCLLVM::FixedVectorType>(loadType)->getNumElements() : 1;
484          if (predDefSurface == ESURFACE_SLM)
485          {
486              IGC_ASSERT(numElement <= 4);
487 @@ -10919,7 +10920,7 @@ void EmitPass::emitInsert(llvm::Instruction* inst)
488              pVecVar = GetSymbol(pVec);
489              if (pVecVar != pInstVar)
490              {
491 -                emitVectorCopy(pInstVar, pVecVar, int_cast<unsigned>(dyn_cast<VectorType>(pVecType)->getNumElements()));
492 +                emitVectorCopy(pInstVar, pVecVar, int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(pVecType)->getNumElements()));
493              }
494          }
495      }
496 @@ -14753,7 +14754,7 @@ bool EmitPass::isUniformStoreOCL(llvm::StoreInst* SI)
497  
498      Value* storeVal = SI->getValueOperand();
499      Type* Ty = storeVal->getType();
500 -    VectorType* VTy = dyn_cast<VectorType>(Ty);
501 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
502      uint32_t elts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
503      Type* eltTy = VTy ? VTy->getElementType() : Ty;
504  
505 @@ -14783,7 +14784,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
506      if (srcTy->isVectorTy())
507      {
508          srcEltTy = cast<VectorType>(srcTy)->getElementType();
509 -        srcNElts = (uint32_t)cast<VectorType>(srcTy)->getNumElements();
510 +        srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(srcTy)->getNumElements();
511      }
512      else
513      {
514 @@ -14793,7 +14794,7 @@ void EmitPass::emitVectorBitCast(llvm::BitCastInst* BCI)
515      if (dstTy->isVectorTy())
516      {
517          dstEltTy = cast<VectorType>(dstTy)->getElementType();
518 -        dstNElts = (uint32_t)cast<VectorType>(dstTy)->getNumElements();
519 +        dstNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements();
520      }
521      else
522      {
523 @@ -15372,7 +15373,7 @@ void EmitPass::emitVectorLoad(LoadInst* inst, Value* offset, ConstantInt* immOff
524      }
525  
526      Type* Ty = inst->getType();
527 -    VectorType* VTy = dyn_cast<VectorType>(Ty);
528 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
529      Type* eltTy = VTy ? VTy->getElementType() : Ty;
530      uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy);
531      IGC_ASSERT_MESSAGE((eltBytes == 1) || (eltBytes == 2) || (eltBytes == 4) || (eltBytes == 8),
532 @@ -15824,7 +15825,7 @@ void EmitPass::emitVectorStore(StoreInst* inst, Value* offset, ConstantInt* immO
533  
534      Value* storedVal = inst->getValueOperand();
535      Type* Ty = storedVal->getType();
536 -    VectorType* VTy = dyn_cast<VectorType>(Ty);
537 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
538      Type* eltTy = VTy ? VTy->getElementType() : Ty;
539      uint32_t eltBytes = GetScalarTypeSizeInRegister(eltTy);
540  
541 @@ -16628,7 +16629,7 @@ void EmitPass::emitCopyAll(CVariable* Dst, CVariable* Src, llvm::Type* Ty)
542      }
543      else if (Ty->isVectorTy())
544      {
545 -        unsigned NElts = (unsigned)cast<VectorType>(Ty)->getNumElements();
546 +        unsigned NElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
547          emitVectorCopy(Dst, Src, NElts);
548      }
549      else
550 diff --git a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
551 index 28248f3062..767b477af1 100644
552 --- a/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
553 +++ b/IGC/Compiler/CISACodeGen/Emu64OpsPass.cpp
554 @@ -1961,7 +1961,7 @@ bool InstExpander::visitExtractElement(ExtractElementInst& EEI) {
555      // later.
556  
557      Value* V = EEI.getVectorOperand();
558 -    unsigned NumElts = (unsigned)cast<VectorType>(V->getType())->getNumElements();
559 +    unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(V->getType())->getNumElements();
560      V = IRB->CreateBitCast(V, Emu->getV2Int32Ty(NumElts));
561      // Re-calculate indices to Lo and Hi parts.
562      Value* Idx = EEI.getIndexOperand();
563 @@ -1998,7 +1998,7 @@ bool InstExpander::visitInsertElement(InsertElementInst& IEI) {
564  
565      // Create the emulated vector.
566      Value* NewVal = IEI.getOperand(0);
567 -    unsigned NumElts = (unsigned)cast<VectorType>(NewVal->getType())->getNumElements();
568 +    unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(NewVal->getType())->getNumElements();
569      NewVal = IRB->CreateBitCast(NewVal, Emu->getV2Int32Ty(NumElts));
570      // Re-calculate indices to Lo and Hi parts.
571      Value* Idx = IEI.getOperand(2);
572 diff --git a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
573 index c74a2ac6ef..78e8a4aa30 100644
574 --- a/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
575 +++ b/IGC/Compiler/CISACodeGen/GenIRLowering.cpp
576 @@ -453,7 +453,7 @@ Value* GEPLowering::getSExtOrTrunc(Value* Val, Type* NewTy) const {
577  
578      IGC_ASSERT_MESSAGE(OldTy->isIntOrIntVectorTy(), "Index should be Integer or vector of Integer!");
579  
580 -    if (auto OldVecTy = dyn_cast<VectorType>(OldTy)) {
581 +    if (auto OldVecTy = dyn_cast<IGCLLVM::FixedVectorType>(OldTy)) {
582          OldWidth = (unsigned)OldVecTy->getNumElements() * OldVecTy->getElementType()->getIntegerBitWidth();
583          NewWidth = (unsigned)OldVecTy->getNumElements() * NewTy->getIntegerBitWidth();
584      }
585 @@ -805,7 +805,7 @@ bool GEPLowering::lowerGetElementPtrInst(GetElementPtrInst* GEP) const
586                  }
587                  else
588                  {
589 -                    if (auto NewIdxVT = dyn_cast<VectorType>(NewIdx->getType())) {
590 +                    if (auto NewIdxVT = dyn_cast<IGCLLVM::FixedVectorType>(NewIdx->getType())) {
591                          Value* result = llvm::UndefValue::get(FixedVectorType::get(PtrMathTy, (unsigned)NewIdxVT->getNumElements()));
592                          for (uint32_t j = 0; j < (uint32_t)NewIdxVT->getNumElements(); j++) {
593                              result = Builder->CreateInsertElement(result, PointerValue, Builder->getInt32(j));
594 diff --git a/IGC/Compiler/CISACodeGen/GenSimplification.cpp b/IGC/Compiler/CISACodeGen/GenSimplification.cpp
595 index 8c38f2292e..f432061e64 100644
596 --- a/IGC/Compiler/CISACodeGen/GenSimplification.cpp
597 +++ b/IGC/Compiler/CISACodeGen/GenSimplification.cpp
598 @@ -35,6 +35,7 @@ IN THE SOFTWARE.
599  #include <llvm/IR/InstVisitor.h>
600  #include <llvm/IR/Instruction.h>
601  #include <llvm/Support/raw_ostream.h>
602 +#include <llvmWrapper/IR/DerivedTypes.h>
603  #include "common/LLVMWarningsPop.hpp"
604  #include "Probe/Assertion.h"
605  
606 @@ -164,7 +165,7 @@ bool GenSimplification::simplifyVectorPHINodeCase2(PHINode& PN) const {
607  
608      Type* Ty = PN.getType();
609      Type* EltTy = Ty->getScalarType();
610 -    unsigned NumElts = (unsigned)cast<VectorType>(Ty)->getNumElements();
611 +    unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
612  
613      SmallVector<Value*, 8> Lanes;
614      SmallVector<SmallVector<Value*, 8>, 4> Values;
615 @@ -238,7 +239,7 @@ void GenSimplification::visitPHINode(PHINode& PN) {
616  void GenSimplification::visitExtractElement(ExtractElementInst& EEI) {
617      // Skip non-2-element vector.
618      Value* Vec = EEI.getVectorOperand();
619 -    VectorType* VTy = cast<VectorType>(Vec->getType());
620 +    IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(Vec->getType());
621      if (VTy->getNumElements() != 2)
622          return;
623  
624 diff --git a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
625 index a5d6594820..32c4759fdb 100644
626 --- a/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
627 +++ b/IGC/Compiler/CISACodeGen/GeometryShaderLowering.cpp
628 @@ -33,6 +33,7 @@ IN THE SOFTWARE.
629  #include <llvm/IR/PassManager.h>
630  #include <llvm/IR/IRBuilder.h>
631  #include <llvm/IR/Verifier.h>
632 +#include <llvmWrapper/IR/DerivedTypes.h>
633  #include "common/LLVMWarningsPop.hpp"
634  #include "Compiler/InitializePasses.h"
635  #include "Probe/Assertion.h"
636 @@ -507,7 +508,7 @@ void GeometryShaderLowering::AddURBRead(
637      {
638          Value* vec = UndefValue::get(inst->getType());
639          IRBuilder<> builder(inst);
640 -        for (unsigned int i = 0; i < cast<VectorType>(inst->getType())->getNumElements(); i++)
641 +        for (unsigned int i = 0; i < cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements(); i++)
642          {
643              Value* vecElement = builder.CreateExtractElement(urbRead, builder.getInt32(i));
644              vec = builder.CreateInsertElement(vec, vecElement, builder.getInt32(i));
645 diff --git a/IGC/Compiler/CISACodeGen/LdShrink.cpp b/IGC/Compiler/CISACodeGen/LdShrink.cpp
646 index d89fbd0e82..2df06df2fd 100644
647 --- a/IGC/Compiler/CISACodeGen/LdShrink.cpp
648 +++ b/IGC/Compiler/CISACodeGen/LdShrink.cpp
649 @@ -30,6 +30,7 @@ IN THE SOFTWARE.
650  #include <llvm/Support/Debug.h>
651  #include <llvm/Support/MathExtras.h>
652  #include <llvm/Support/raw_ostream.h>
653 +#include <llvmWrapper/IR/DerivedTypes.h>
654  #include "common/LLVMWarningsPop.hpp"
655  #include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
656  #include "Compiler/IGCPassSupport.h"
657 @@ -79,7 +80,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)
659  
660  unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const {
661 -    VectorType* VTy = dyn_cast<VectorType>(LI->getType());
662 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(LI->getType());
663      // Skip non-vector loads.
664      if (!VTy)
665          return 0;
666 @@ -91,9 +92,12 @@ unsigned LdShrink::getExtractIndexMask(LoadInst* LI) const {
667      Type* Ty = VTy->getScalarType();
668      // Skip non-BYTE addressable data types. So far, check integer types
669      // only.
670 -    if (IntegerType * ITy = dyn_cast<IntegerType>(Ty))
671 -        if (!ITy->isPowerOf2ByteWidth())
672 +    if (IntegerType * ITy = dyn_cast<IntegerType>(Ty)) {
673 +        // Unroll isPowerOf2ByteWidth, it was removed in LLVM 12.
674 +        unsigned BitWidth = ITy->getBitWidth();
675 +        if (!((BitWidth > 7) && isPowerOf2_32(BitWidth)))
676              return 0;
677 +    }
678  
679      unsigned Mask = 0; // Maxmimally 32 elements.
680  
681 diff --git a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
682 index 43febc955a..d9c2fb3ad8 100644
683 --- a/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
684 +++ b/IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp
685 @@ -617,7 +617,7 @@ void TransposeHelper::handleGEPInst(
686              }
687              else
688              {
689 -                arr_sz = (unsigned)cast<VectorType>(T)->getNumElements();
690 +                arr_sz = (unsigned)cast<IGCLLVM::FixedVectorType>(T)->getNumElements();
691              }
692              T = cast<VectorType>(T)->getElementType();
693          }
694 @@ -639,7 +639,7 @@ void TransposeHelper::handleGEPInst(
695          }
696          else if (T->isVectorTy())
697          {
698 -            arr_sz = (unsigned)cast<VectorType>(T)->getNumElements();
699 +            arr_sz = (unsigned)cast<IGCLLVM::FixedVectorType>(T)->getNumElements();
700              T = cast<VectorType>(T)->getElementType();
701          }
702          else
703 @@ -699,7 +699,7 @@ void TransposeHelperPromote::handleLoadInst(
704      IRBuilder<> IRB(pLoad);
705      IGC_ASSERT(nullptr != pLoad->getType());
706      unsigned N = pLoad->getType()->isVectorTy()
707 -        ? (unsigned)cast<VectorType>(pLoad->getType())->getNumElements()
708 +        ? (unsigned)cast<IGCLLVM::FixedVectorType>(pLoad->getType())->getNumElements()
709          : 1;
710      Value* Val = loadEltsFromVecAlloca(N, pVecAlloca, pScalarizedIdx, IRB, pLoad->getType()->getScalarType());
711      pLoad->replaceAllUsesWith(Val);
712 @@ -731,7 +731,7 @@ void TransposeHelperPromote::handleStoreInst(
713          // %v1 = extractelement <2 x float> %v, i32 1
714          // %w1 = insertelement <32 x float> %w0, float %v1, i32 %idx+1
715          // store <32 x float> %w1, <32 x float>* %ptr1
716 -        for (unsigned i = 0, e = (unsigned)cast<VectorType>(pStoreVal->getType())->getNumElements(); i < e; ++i)
717 +        for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(pStoreVal->getType())->getNumElements(); i < e; ++i)
718          {
719              Value* VectorIdx = ConstantInt::get(pScalarizedIdx->getType(), i);
720              auto Val = IRB.CreateExtractElement(pStoreVal, VectorIdx);
721 diff --git a/IGC/Compiler/CISACodeGen/MemOpt.cpp b/IGC/Compiler/CISACodeGen/MemOpt.cpp
722 index 027734c105..debb7e22ba 100644
723 --- a/IGC/Compiler/CISACodeGen/MemOpt.cpp
724 +++ b/IGC/Compiler/CISACodeGen/MemOpt.cpp
725 @@ -125,7 +125,7 @@ namespace {
726              MemRefListTy& MemRefs, TrivialMemRefListTy& ToOpt);
727  
728          unsigned getNumElements(Type* Ty) const {
729 -            return Ty->isVectorTy() ? (unsigned)cast<VectorType>(Ty)->getNumElements() : 1;
730 +            return Ty->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements() : 1;
731          }
732  
733          MemoryLocation getLocation(Instruction* I) const {
734 @@ -798,7 +798,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad,
735              Pos = unsigned((std::get<1>(I) - FirstOffset) / LdScalarSize);
736  
737          if (Ty->isVectorTy()) {
738 -            if (Pos + cast<VectorType>(Ty)->getNumElements() > NumElts) {
739 +            if (Pos + cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements() > NumElts) {
740                  // 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,
742                  // we'll generate correct code if it does since we don't remove the
743 @@ -806,7 +806,7 @@ bool MemOpt::mergeLoad(LoadInst* LeadingLoad,
744                  continue;
745              }
746              Value* Val = UndefValue::get(Ty);
747 -            for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i) {
748 +            for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i) {
749                  Value* Ex = Builder.CreateExtractElement(NewLoad, Builder.getInt32(Pos + i));
750                  Ex = createBitOrPointerCast(Ex, ScalarTy, Builder);
751                  Val = Builder.CreateInsertElement(Val, Ex, Builder.getInt32(i));
752 @@ -1084,7 +1084,7 @@ bool MemOpt::mergeStore(StoreInst* LeadingStore,
753          IGC_ASSERT(hasSameSize(ScalarTy, LeadingStoreScalarType));
754  
755          if (Ty->isVectorTy()) {
756 -            for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i) {
757 +            for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i) {
758                  Value* Ex = Builder.CreateExtractElement(Val, Builder.getInt32(i));
759                  Ex = createBitOrPointerCast(Ex, LeadingStoreScalarType, Builder);
760                  NewStoreVal = Builder.CreateInsertElement(NewStoreVal, Ex,
761 diff --git a/IGC/Compiler/CISACodeGen/MemOpt2.cpp b/IGC/Compiler/CISACodeGen/MemOpt2.cpp
762 index 4b2628d2b1..20115c73a3 100644
763 --- a/IGC/Compiler/CISACodeGen/MemOpt2.cpp
764 +++ b/IGC/Compiler/CISACodeGen/MemOpt2.cpp
765 @@ -32,6 +32,7 @@ IN THE SOFTWARE.
766  #include <llvm/Support/Debug.h>
767  #include <llvm/Support/raw_ostream.h>
768  #include <llvm/Transforms/Utils/Local.h>
769 +#include <llvmWrapper/IR/DerivedTypes.h>
770  #include "common/LLVMWarningsPop.hpp"
771  #include "GenISAIntrinsics/GenIntrinsics.h"
772  
773 @@ -124,7 +125,7 @@ namespace {
774              if (!Ty->isSingleValueType())
775                  return UINT_MAX;
776              // Simply return 1 so far for scalar types.
777 -            VectorType* VecTy = dyn_cast<VectorType>(Ty);
778 +            IGCLLVM::FixedVectorType* VecTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
779              if (!VecTy)
780                  return 1;
781              // Check how that vector is used.
782 @@ -153,7 +154,7 @@ namespace {
783                  return UINT_MAX;
784              unsigned EltByte = (Ty->getScalarSizeInBits() + 7) / 8;
785              // Simply return 1 so far for scalar types.
786 -            VectorType* VecTy = dyn_cast<VectorType>(Ty);
787 +            IGCLLVM::FixedVectorType* VecTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
788              if (!VecTy)
789                  return EltByte;
790              // Check how that vector is used.
791 diff --git a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
792 index 8d6d7801db..349235a812 100644
793 --- a/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
794 +++ b/IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp
795 @@ -425,7 +425,7 @@ namespace IGC
796          unsigned int numElements = 1;
797          if (baseType->isVectorTy())
798          {
799 -            numElements = (unsigned)cast<VectorType>(baseType)->getNumElements();
800 +            numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(baseType)->getNumElements();
801              baseType = cast<VectorType>(baseType)->getElementType();
802          }
803  
804 diff --git a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
805 index 4397af09c7..484e8d5c43 100644
806 --- a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
807 +++ b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp
808 @@ -2959,8 +2959,8 @@ namespace IGC
809                  llvm::Type* srcTy = bTInst->getOperand(0)->getType();
810                  llvm::Type* dstTy = bTInst->getType();
811  
812 -                srcNElts = (srcTy->isVectorTy()) ? (uint32_t)cast<VectorType>(srcTy)->getNumElements() : 1;
813 -                dstNElts = (dstTy->isVectorTy()) ? (uint32_t)cast<VectorType>(dstTy)->getNumElements() : 1;
814 +                srcNElts = (srcTy->isVectorTy()) ? (uint32_t)cast<IGCLLVM::FixedVectorType>(srcTy)->getNumElements() : 1;
815 +                dstNElts = (dstTy->isVectorTy()) ? (uint32_t)cast<IGCLLVM::FixedVectorType>(dstTy)->getNumElements() : 1;
816  
817                  if (srcNElts < dstNElts && srcTy->getScalarSizeInBits() < 64)
818                  {
819 diff --git a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
820 index 410fc99c0e..e61db1ffae 100644
821 --- a/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
822 +++ b/IGC/Compiler/CISACodeGen/PushAnalysis.cpp
823 @@ -1003,7 +1003,7 @@ namespace IGC
824  
825          if (pTypeToPush->isVectorTy())
826          {
827 -            num_elms = (unsigned)cast<VectorType>(pTypeToPush)->getNumElements();
828 +            num_elms = (unsigned)cast<IGCLLVM::FixedVectorType>(pTypeToPush)->getNumElements();
829              pTypeToPush = cast<VectorType>(pTypeToPush)->getElementType();
830              llvm::Type* pVecTy = IGCLLVM::FixedVectorType::get(pTypeToPush, num_elms);
831              pReplacedInst = llvm::UndefValue::get(pVecTy);
832 @@ -1194,7 +1194,7 @@ namespace IGC
833          }
834  
835          unsigned num_elms =
836 -            inst->getType()->isVectorTy() ? (unsigned)cast<VectorType>(inst->getType())->getNumElements() : 1;
837 +            inst->getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements() : 1;
838          llvm::Type* pTypeToPush = inst->getType();
839          llvm::Value* replaceVector = nullptr;
840          unsigned int numberChannelReplaced = 0;
841 diff --git a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
842 index 95b937e735..1c6544a489 100644
843 --- a/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
844 +++ b/IGC/Compiler/CISACodeGen/RegisterEstimator.cpp
845 @@ -41,6 +41,7 @@ IN THE SOFTWARE.
846  #include <llvm/IR/IRBuilder.h>
847  #include <llvm/IR/InstIterator.h>
848  #include <llvm/Support/MathExtras.h>
849 +#include <llvmWrapper/IR/DerivedTypes.h>
850  #include "common/LLVMWarningsPop.hpp"
851  #include "Probe/Assertion.h"
852  
853 @@ -146,7 +147,7 @@ RegUse RegisterEstimator::estimateNumOfRegs(Value* V) const
854      Type* Ty = V->getType();
855      if (!Ty->isVoidTy())
856      {
857 -        VectorType* VTy = dyn_cast<VectorType>(Ty);
858 +        IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
859          Type* eltTy = VTy ? VTy->getElementType() : Ty;
860          uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
861          uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy);
862 diff --git a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
863 index beac138d5a..ceeafa48fc 100644
864 --- a/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
865 +++ b/IGC/Compiler/CISACodeGen/RegisterPressureEstimate.hpp
866 @@ -42,6 +42,7 @@ See LRCENSE.TXT for details.
867  #include "llvm/Pass.h"
868  #include <llvm/IR/InstVisitor.h>
869  #include "llvm/Analysis/LoopInfo.h"
870 +#include <llvmWrapper/IR/DerivedTypes.h>
871  #include "common/LLVMWarningsPop.hpp"
872  #include "Compiler/IGCPassSupport.h"
873  #include "Compiler/CISACodeGen/WIAnalysis.hpp"
874 @@ -240,7 +241,7 @@ namespace IGC
875              auto Ty = V->getType();
876              if (Ty->isVoidTy())
877                  return 0;
878 -            auto VTy = llvm::dyn_cast<llvm::VectorType>(Ty);
879 +            auto VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(Ty);
880              auto eltTy = VTy ? VTy->getElementType() : Ty;
881              uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
882              uint32_t eltBits = (uint32_t)m_DL->getTypeSizeInBits(eltTy);
883 diff --git a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
884 index 962083f453..26a7b8be21 100644
885 --- a/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
886 +++ b/IGC/Compiler/CISACodeGen/SLMConstProp.cpp
887 @@ -39,6 +39,7 @@ IN THE SOFTWARE.
888  #include <llvm/IR/InstIterator.h>
889  #include <llvm/Support/Debug.h>
890  #include <llvm/Support/MathExtras.h>
891 +#include "llvmWrapper/IR/DerivedTypes.h"
892  #include "common/LLVMWarningsPop.hpp"
893  #include <vector>
894  #include "Probe/Assertion.h"
895 @@ -629,7 +630,7 @@ bool SLMConstProp::isEqual(Constant* C0, Constant* C1)
896  
897  bool SLMConstProp::isFloatType(Type* Ty)
898  {
899 -    if (VectorType * vTy = dyn_cast<VectorType>(Ty))
900 +    if (IGCLLVM::FixedVectorType * vTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty))
901      {
902          if (vTy->getNumElements() > 1)
903          {
904 diff --git a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
905 index ce81641691..32ab79c1dd 100644
906 --- a/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
907 +++ b/IGC/Compiler/CISACodeGen/ScalarizerCodeGen.cpp
908 @@ -66,7 +66,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I)
909          {
910              bool isNewTypeVector = false;
911  
912 -            VectorType* instType = cast<VectorType>(I.getType());
913 +            IGCLLVM::FixedVectorType* instType = cast<IGCLLVM::FixedVectorType>(I.getType());
914              unsigned numElements = int_cast<unsigned>(instType->getNumElements());
915              unsigned scalarSize = instType->getScalarSizeInBits();
916              unsigned newScalarBits = numElements * scalarSize;
917 @@ -111,7 +111,7 @@ void ScalarizerCodeGen::visitBinaryOperator(llvm::BinaryOperator& I)
918                  }
919                  else
920                  {
921 -                    VectorType* newVecType = cast<VectorType>(newType);
922 +                    IGCLLVM::FixedVectorType* newVecType = cast<IGCLLVM::FixedVectorType>(newType);
923                      unsigned newVecTypeNumEle = int_cast<unsigned>(newVecType->getNumElements());
924                      Value* ieLogicOp = UndefValue::get(newType);
925                      for (unsigned i = 0; i < newVecTypeNumEle; i++)
926 diff --git a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
927 index 563d95173c..3b974da405 100644
928 --- a/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
929 +++ b/IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp
930 @@ -638,12 +638,17 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi
931      {
932          mpm.add(createPruneUnusedArgumentsPass());
933  
934 +#if LLVM_VERSION_MAJOR >= 12
935 +        mpm.add(createIPSCCPPass());
936 +#else
937          if (IGC_GET_FLAG_VALUE(FunctionControl) == FLAG_FCALL_DEFAULT)
938          {
939              // Don't run IPConstantProp when debugging function calls, to avoid folding function arg/ret constants
940              mpm.add(createIPConstantPropagationPass());
941          }
942          mpm.add(createConstantPropagationPass());
943 +#endif
944 +
945          mpm.add(createDeadCodeEliminationPass());
946          mpm.add(createCFGSimplificationPass());
947      }
948 @@ -1541,8 +1546,13 @@ void OptimizeIR(CodeGenContext* const pContext)
949              // possible which potentially allows late stage code sinking of
950              // those calls by the instruction combiner.
951              mpm.add(createPostOrderFunctionAttrsLegacyPass());
952 +
953 +#if LLVM_VERSION_MAJOR >= 12
954 +            mpm.add(createIPSCCPPass());
955 +#else
956              mpm.add(createConstantPropagationPass());
957              mpm.add(createIPConstantPropagationPass());
958 +#endif
959          }
960  
961          // enable this only when Pooled EU is not supported
962 diff --git a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
963 index 4760b3e792..3e22f3aa68 100644
964 --- a/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
965 +++ b/IGC/Compiler/CISACodeGen/Simd32Profitability.cpp
966 @@ -28,8 +28,10 @@ IN THE SOFTWARE.
967  #include "Compiler/CISACodeGen/Platform.hpp"
968  #include "common/LLVMWarningsPush.hpp"
969  #include <llvmWrapper/IR/DerivedTypes.h>
970 +#include <llvmWrapper/Transforms/Utils/LoopUtils.h>
971  #include <llvm/IR/InstIterator.h>
972  #include <llvm/IR/Operator.h>
973 +#include <llvmWrapper/IR/DerivedTypes.h>
974  #include "common/LLVMWarningsPop.hpp"
975  #include "GenISAIntrinsics/GenIntrinsics.h"
976  #include "GenISAIntrinsics/GenIntrinsicInst.h"
977 @@ -577,7 +579,7 @@ static bool isPayloadHeader(Value* V) {
978      Argument* Arg = dyn_cast<Argument>(V);
979      if (!Arg || !Arg->hasName())
980          return false;
981 -    VectorType* VTy = dyn_cast<VectorType>(Arg->getType());
982 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType());
983      if (!VTy || VTy->getNumElements() != 8 ||
984          !VTy->getElementType()->isIntegerTy(32))
985          return false;
986 @@ -588,7 +590,7 @@ static bool isR0(Value* V) {
987      Argument* Arg = dyn_cast<Argument>(V);
988      if (!Arg || !Arg->hasName())
989          return false;
990 -    VectorType* VTy = dyn_cast<VectorType>(Arg->getType());
991 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType());
992      if (!VTy || VTy->getNumElements() != 8 ||
993          !VTy->getElementType()->isIntegerTy(32))
994          return false;
995 @@ -599,7 +601,7 @@ static bool isEnqueuedLocalSize(Value* V) {
996      Argument* Arg = dyn_cast<Argument>(V);
997      if (!Arg || !Arg->hasName())
998          return false;
999 -    VectorType* VTy = dyn_cast<VectorType>(Arg->getType());
1000 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Arg->getType());
1001      if (!VTy || VTy->getNumElements() != 3 ||
1002          !VTy->getElementType()->isIntegerTy(32))
1003          return false;
1004 @@ -998,7 +1000,7 @@ static bool hasLongStridedLdStInLoop(Function* F, LoopInfo* LI, WIAnalysis* WI)
1005      // Collect innermost simple loop.
1006      for (auto I = LI->begin(), E = LI->end(); I != E; ++I) {
1007          auto L = *I;
1008 -        if (!L->empty())
1009 +        if (!IGCLLVM::isInnermost(L))
1010              continue;
1011          if (L->getNumBlocks() != 2)
1012              continue;
1013 diff --git a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
1014 index 73f472b5b9..0069c4b1bb 100644
1015 --- a/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
1016 +++ b/IGC/Compiler/CISACodeGen/SimplifyConstant.cpp
1017 @@ -352,7 +352,7 @@ static unsigned getLegalVectorSize(unsigned N) {
1018  // Check vector size. We may demote the data type if all values can fit into
1019  // smaller data type.
1020  //
1021 -static bool checkSize(GlobalVariable* GV, VectorType*& DataType,
1022 +static bool checkSize(GlobalVariable* GV, IGCLLVM::FixedVectorType*& DataType,
1023      bool& IsSigned) {
1024      Constant* Init = GV->getInitializer();
1025      IGC_ASSERT(isa<ArrayType>(Init->getType()));
1026 @@ -360,7 +360,7 @@ static bool checkSize(GlobalVariable* GV, VectorType*& DataType,
1027      unsigned N = (unsigned)ArrayTy->getArrayNumElements();
1028      Type* BaseTy = ArrayTy->getArrayElementType();
1029      unsigned VectorSize = 1;
1030 -    if (auto VT = dyn_cast<VectorType>(BaseTy)) {
1031 +    if (auto VT = dyn_cast<IGCLLVM::FixedVectorType>(BaseTy)) {
1032          BaseTy = VT->getElementType();
1033          VectorSize = int_cast<unsigned>(VT->getNumElements());
1034          N *= VectorSize;
1035 @@ -483,7 +483,7 @@ static Constant* getConstantVal(Type* VEltTy, Constant* V, bool IsSigned) {
1036      return ConstantInt::get(VEltTy, IVal, IsSigned);
1037  }
1038  
1039 -static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
1040 +static void promote(GlobalVariable* GV, IGCLLVM::FixedVectorType* AllocaType, bool IsSigned,
1041      Function* F) {
1042      // Build the constant vector from constant array.
1043      unsigned VS = int_cast<unsigned>(AllocaType->getNumElements());
1044 @@ -507,7 +507,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
1045              Constant* const Elt = CA->getAggregateElement(i);
1046              IGC_ASSERT_MESSAGE(nullptr != Elt, "Null AggregateElement");
1047              if (auto EltTy = dyn_cast<VectorType>(Elt->getType())) {
1048 -                unsigned VectorSize = (unsigned)cast<VectorType>(EltTy)->getNumElements();
1049 +                unsigned VectorSize = (unsigned)cast<IGCLLVM::FixedVectorType>(EltTy)->getNumElements();
1050                  for (unsigned j = 0; j < VectorSize; ++j) {
1051                      Constant* V = Elt->getAggregateElement(j);
1052                      Vals[i * VectorSize + j] = getConstantVal(VEltTy, V, IsSigned);
1053 @@ -549,7 +549,7 @@ static void promote(GlobalVariable* GV, VectorType* AllocaType, bool IsSigned,
1054              unsigned N = 1;
1055              Value* Offset = Index;
1056              if (Ty->isVectorTy()) {
1057 -                N = (unsigned)cast<VectorType>(Ty)->getNumElements();
1058 +                N = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
1059                  Offset = Builder.CreateMul(Offset, ConstantInt::get(Offset->getType(), N));
1060              }
1061              Value* Val = extractNElts(N, VectorData, Offset, Builder);
1062 @@ -684,7 +684,7 @@ bool PromoteConstant::runOnFunction(Function& F) {
1063  
1064          // If possible demote the data into smaller type. Uses of value will be
1065          // promoted back with ZExt or SExt.
1066 -        VectorType* AllocaType = nullptr;
1067 +        IGCLLVM::FixedVectorType* AllocaType = nullptr;
1068          bool IsSigned = false;
1069          if (!checkSize(GV, AllocaType, IsSigned))
1070              continue;
1071 diff --git a/IGC/Compiler/CISACodeGen/TypeDemote.cpp b/IGC/Compiler/CISACodeGen/TypeDemote.cpp
1072 index eb7a7b6482..b04a0f6e51 100644
1073 --- a/IGC/Compiler/CISACodeGen/TypeDemote.cpp
1074 +++ b/IGC/Compiler/CISACodeGen/TypeDemote.cpp
1075 @@ -32,6 +32,7 @@ IN THE SOFTWARE.
1076  #include <llvm/ADT/PostOrderIterator.h>
1077  #include <llvm/IR/IRBuilder.h>
1078  #include <llvm/Pass.h>
1079 +#include <llvmWrapper/IR/DerivedTypes.h>
1080  #include "common/LLVMWarningsPop.hpp"
1081  #include "GenISAIntrinsics/GenIntrinsics.h"
1082  #include "Probe/Assertion.h"
1083 @@ -288,7 +289,7 @@ bool TypeDemote::demoteOnBasicBlock(BasicBlock* BB) const {
1084              CastInst* CI = dyn_cast<CastInst>(Index);
1085              if (CI && (CI->getOpcode() == Instruction::ZExt ||
1086                  CI->getOpcode() == Instruction::SExt)) {
1087 -                unsigned VS = (unsigned)cast<VectorType>(EEI->getVectorOperandType())->getNumElements();
1088 +                unsigned VS = (unsigned)cast<IGCLLVM::FixedVectorType>(EEI->getVectorOperandType())->getNumElements();
1089                  unsigned N = (unsigned int)CI->getSrcTy()->getPrimitiveSizeInBits();
1090                  unsigned Bound = (N < 32) ? (1U << N) : UINT32_MAX;
1091                  if (VS <= Bound) {
1092 diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
1093 index 1cac7b1209..12c4734e96 100644
1094 --- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
1095 +++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.cpp
1096 @@ -28,6 +28,7 @@ IN THE SOFTWARE.
1097  #include "Compiler/CodeGenPublic.h"
1098  #include "common/LLVMWarningsPush.hpp"
1099  #include <llvm/Support/Debug.h>
1100 +#include "llvmWrapper/IR/DerivedTypes.h"
1101  #include "common/LLVMWarningsPop.hpp"
1102  #include <algorithm>
1103  #include "Probe/Assertion.h"
1104 @@ -40,13 +41,13 @@ namespace
1105      // If V is scalar, return 1.
1106      // if V is vector, return the number of elements.
1107      inline int getNumElts(Value* V) {
1108 -        VectorType* VTy = dyn_cast<VectorType>(V->getType());
1109 +        IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(V->getType());
1110          return VTy ? (int)VTy->getNumElements() : 1;
1111      }
1112  
1113      inline int getTypeSizeInBits(Type* Ty) {
1114          int scalarBits = Ty->getScalarSizeInBits();
1115 -        VectorType* VTy = dyn_cast<VectorType>(Ty);
1116 +        IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
1117          return scalarBits * (VTy ? (int)VTy->getNumElements() : 1);
1118      }
1119  }
1120 diff --git a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
1121 index 56dac17e45..42081dcaa9 100644
1122 --- a/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
1123 +++ b/IGC/Compiler/CISACodeGen/VariableReuseAnalysis.hpp
1124 @@ -37,6 +37,7 @@ IN THE SOFTWARE.
1125  #include <llvm/IR/InstIterator.h>
1126  #include <llvm/IR/InstVisitor.h>
1127  #include "llvm/Pass.h"
1128 +#include "llvmWrapper/IR/DerivedTypes.h"
1129  #include "llvm/Support/raw_ostream.h"
1130  #include "common/LLVMWarningsPop.hpp"
1131  #include "Compiler/CISACodeGen/RegisterEstimator.hpp"
1132 @@ -79,7 +80,7 @@ namespace IGC {
1133          SSubVecDesc(llvm::Value* V)
1134              : Aliaser(V), BaseVector(V), StartElementOffset(0)
1135          {
1136 -            llvm::VectorType* VTy = llvm::dyn_cast<llvm::VectorType>(V->getType());
1137 +            IGCLLVM::FixedVectorType* VTy = llvm::dyn_cast<IGCLLVM::FixedVectorType>(V->getType());
1138              NumElts = VTy ? (short)VTy->getNumElements() : 1;
1139          }
1140  
1141 diff --git a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
1142 index 022e0eb010..6edd19fa74 100644
1143 --- a/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
1144 +++ b/IGC/Compiler/CISACodeGen/VectorPreProcess.cpp
1145 @@ -500,7 +500,7 @@ void VectorPreProcess::replaceAllVectorUsesWithScalars(Instruction* VI, ValVecto
1146              I = VI->getParent()->getFirstNonPHI();
1147          }
1148          IRBuilder<> Builder(I);
1149 -        VectorType* VTy = cast<VectorType>(VI->getType());
1150 +        IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(VI->getType());
1151          Value* newVec = UndefValue::get(VTy);
1152          for (uint32_t i = 0, e = int_cast<uint32_t>(VTy->getNumElements()); i < e; ++i)
1153          {
1154 @@ -619,7 +619,7 @@ bool VectorPreProcess::splitStore(
1155  {
1156      Instruction* SI = ASI.getInst();
1157      Value* StoredVal = ASI.getValueOperand();
1158 -    VectorType* VTy = cast<VectorType>(StoredVal->getType());
1159 +    IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(StoredVal->getType());
1160      Type* ETy = VTy->getElementType();
1161      uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements());
1162  
1163 @@ -705,7 +705,7 @@ bool VectorPreProcess::splitStore(
1164          {
1165              Type* Ty1 = splitInfo[i].first;
1166              uint32_t len1 = splitInfo[i].second;
1167 -            VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
1168 +            IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
1169              for (uint32_t j = 0; j < len1; ++j)
1170              {
1171                  Value* subVec;
1172 @@ -742,7 +742,7 @@ bool VectorPreProcess::splitStore(
1173      {
1174          Type* Ty1 = splitInfo[i].first;
1175          uint32_t len1 = splitInfo[i].second;
1176 -        VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
1177 +        IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
1178          for (uint32_t j = 0; j < len1; ++j)
1179          {
1180              uint32_t vAlign = (uint32_t)MinAlign(Align, (uint32_t)eOffset * EBytes);
1181 @@ -786,7 +786,7 @@ bool VectorPreProcess::splitLoad(
1182  {
1183      Instruction* LI = ALI.getInst();
1184      bool isLdRaw = isa<LdRawIntrinsic>(LI);
1185 -    VectorType* VTy = cast<VectorType>(LI->getType());
1186 +    IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(LI->getType());
1187      Type* ETy = VTy->getElementType();
1188      uint32_t nelts = int_cast<uint32_t>(VTy->getNumElements());
1189  
1190 @@ -848,7 +848,7 @@ bool VectorPreProcess::splitLoad(
1191      {
1192          Type* Ty1 = splitInfo[i].first;
1193          uint32_t len1 = splitInfo[i].second;
1194 -        VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
1195 +        IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
1196          for (uint32_t j = 0; j < len1; ++j)
1197          {
1198              uint32_t vAlign = (uint32_t)MinAlign(Align, eOffset * EBytes);
1199 @@ -916,7 +916,7 @@ bool VectorPreProcess::splitLoadStore(
1200      Optional<AbstractStoreInst> ASI = AbstractStoreInst::get(Inst);
1201      IGC_ASSERT_MESSAGE((ALI || ASI), "Inst should be either load or store");
1202      Type* Ty = ALI ? ALI->getInst()->getType() : ASI->getValueOperand()->getType();
1203 -    VectorType* VTy = dyn_cast<VectorType>(Ty);
1204 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
1205      if (!VTy)
1206      {
1207          return false;
1208 @@ -1147,7 +1147,7 @@ void VectorPreProcess::getOrGenScalarValues(
1209  {
1210      availBeforeInst = nullptr;
1211  
1212 -    VectorType* VTy = cast<VectorType>(VecVal->getType());
1213 +    IGCLLVM::FixedVectorType* VTy = cast<IGCLLVM::FixedVectorType>(VecVal->getType());
1214      if (!VTy)
1215      {
1216          scalars[0] = VecVal;
1217 @@ -1298,7 +1298,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
1218          //
1219          // TODO: further optimize this load into a message with channel masks
1220          // for cases in which use indices are sparse like {0, 2}.
1221 -        unsigned N = (unsigned)cast<VectorType>(Inst->getType())->getNumElements();
1222 +        unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(Inst->getType())->getNumElements();
1223          if (N == MaxIndex + 1)
1224              return Inst;
1225  
1226 @@ -1404,7 +1404,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
1227      if (NBits < 32)
1228          return Inst;
1229  
1230 -    unsigned N = (unsigned)cast<VectorType>(Val->getType())->getNumElements();
1231 +    unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(Val->getType())->getNumElements();
1232      if (auto CV = dyn_cast<ConstantVector>(Val))
1233      {
1234          unsigned MaxIndex = 0;
1235 @@ -1573,7 +1573,7 @@ bool VectorPreProcess::runOnFunction(Function& F)
1236                  for (uint32_t j = 0; j < svals.size(); ++j)
1237                  {
1238                      Type* Ty1 = svals[j]->getType();
1239 -                    VectorType* VTy1 = dyn_cast<VectorType>(Ty1);
1240 +                    IGCLLVM::FixedVectorType* VTy1 = dyn_cast<IGCLLVM::FixedVectorType>(Ty1);
1241                      if (VTy1) {
1242                          for (uint32_t k = 0; k < VTy1->getNumElements(); ++k)
1243                          {
1244 @@ -1622,7 +1622,7 @@ bool VectorPreProcess::runOnFunction(Function& F)
1245                      // If this is a 3-element vector load, remove it
1246                      // from m_Vector3List as well.
1247                      if (isAbstractLoadInst(tInst) && tInst->getType()->isVectorTy() &&
1248 -                        cast<VectorType>(tInst->getType())->getNumElements() == 3)
1249 +                        cast<IGCLLVM::FixedVectorType>(tInst->getType())->getNumElements() == 3)
1250                      {
1251                          InstWorkVector::iterator
1252                              tI = m_Vector3List.begin(),
1253 diff --git a/IGC/Compiler/CISACodeGen/VectorProcess.cpp b/IGC/Compiler/CISACodeGen/VectorProcess.cpp
1254 index 9f39cdc0d7..cfe45321d2 100644
1255 --- a/IGC/Compiler/CISACodeGen/VectorProcess.cpp
1256 +++ b/IGC/Compiler/CISACodeGen/VectorProcess.cpp
1257 @@ -240,7 +240,7 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst)
1258      IGC_ASSERT(nullptr != Ptr);
1259      IGC_ASSERT(nullptr != Ty);
1260  
1261 -    VectorType* const VTy = dyn_cast<VectorType>(Ty);
1262 +    IGCLLVM::FixedVectorType* const VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
1263  
1264      // Treat a scalar as 1-element vector
1265      uint32_t nelts = VTy ? int_cast<uint32_t>(VTy->getNumElements()) : 1;
1266 @@ -654,7 +654,7 @@ void VectorMessage::getInfo(Type* Ty, uint32_t Align, bool useA32,
1267      VectorType* VTy = dyn_cast<VectorType>(Ty);
1268      Type* eTy = VTy ? cast<VectorType>(VTy)->getElementType() : Ty;
1269      unsigned eltSize = m_emitter->GetScalarTypeSizeInRegister(eTy);
1270 -    unsigned nElts = VTy ? (unsigned)cast<VectorType>(VTy)->getNumElements() : 1;
1271 +    unsigned nElts = VTy ? (unsigned)cast<IGCLLVM::FixedVectorType>(VTy)->getNumElements() : 1;
1272      // total bytes
1273      const unsigned TBytes = nElts * eltSize;
1274  
1275 diff --git a/IGC/Compiler/CISACodeGen/helper.cpp b/IGC/Compiler/CISACodeGen/helper.cpp
1276 index 5719fd3ab8..4dc83c9f1e 100644
1277 --- a/IGC/Compiler/CISACodeGen/helper.cpp
1278 +++ b/IGC/Compiler/CISACodeGen/helper.cpp
1279 @@ -1647,7 +1647,7 @@ namespace IGC
1280              {
1281                  instList[i] = builder.CreateExtractElement(val, static_cast<uint64_t>(0));
1282                  size_t iOld = i;
1283 -                for (unsigned j = 1; j < cast<VectorType>(val->getType())->getNumElements(); j++)
1284 +                for (unsigned j = 1; j < cast<IGCLLVM::FixedVectorType>(val->getType())->getNumElements(); j++)
1285                  {
1286                      instList.insert(instList.begin()+ iOld +j, builder.CreateExtractElement(val, j));
1287                      i++;
1288 @@ -1680,7 +1680,7 @@ namespace IGC
1289              }
1290              break;
1291          case IGCLLVM::VectorTyID:
1292 -            num = (unsigned)cast<VectorType>(type)->getNumElements();
1293 +            num = (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements();
1294              for (unsigned i = 0; i < num; i++)
1295              {
1296                  ScalarizeAggregateMembers(builder, builder.CreateExtractElement(val, i), instList);
1297 @@ -1720,7 +1720,7 @@ namespace IGC
1298              }
1299              break;
1300          case IGCLLVM::VectorTyID:
1301 -            num = (unsigned)cast<VectorType>(type)->getNumElements();
1302 +            num = (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements();
1303              for (unsigned i = 0; i < num; i++)
1304              {
1305                  indices.push_back(builder.getInt32(i));
1306 @@ -1985,8 +1985,8 @@ namespace IGC
1307                  return false;
1308              }
1309  
1310 -            VectorType* dVTy = dyn_cast<VectorType>(dTy);
1311 -            VectorType* sVTy = dyn_cast<VectorType>(sTy);
1312 +            IGCLLVM::FixedVectorType* dVTy = dyn_cast<IGCLLVM::FixedVectorType>(dTy);
1313 +            IGCLLVM::FixedVectorType* sVTy = dyn_cast<IGCLLVM::FixedVectorType>(sTy);
1314              int d_nelts = dVTy ? (int)dVTy->getNumElements() : 1;
1315              int s_nelts = sVTy ? (int)sVTy->getNumElements() : 1;
1316              if (d_nelts != s_nelts) {
1317 diff --git a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
1318 index 07817f05f7..15bbb0400e 100644
1319 --- a/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
1320 +++ b/IGC/Compiler/ConvertMSAAPayloadTo16Bit.cpp
1321 @@ -153,15 +153,15 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
1322              // There are uses of ldmcs other then ldms, using vector of int32 type.
1323              // Fix them to use newly created 16bit ldmcs.
1324              if (ldmcs->getType()->isVectorTy() &&
1325 -                ldmcs->getType()->getVectorElementType() == m_builder->getInt32Ty())
1326 +                cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getElementType()->isFloatTy())
1327              {
1328                  m_builder->SetInsertPoint(ldmcs);
1329  
1330 -                uint ldmcsNumOfElements = ldmcs->getType()->getVectorNumElements();
1331 -                uint newLdmcsNumOfElements = new_mcs_call->getType()->getVectorNumElements();
1332 +                uint ldmcsNumOfElements = (uint)cast<IGCLLVM::FixedVectorType>(ldmcs->getType())->getNumElements();
1333 +                uint newLdmcsNumOfElements = (uint)cast<IGCLLVM::FixedVectorType>(new_mcs_call->getType())->getNumElements();
1334  
1335                  // vec of 16bit ints to vec of 32bit ints
1336 -                Type* newLdmcsVecType = VectorType::get(m_builder->getInt32Ty(), newLdmcsNumOfElements);
1337 +                Type* newLdmcsVecType = IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), newLdmcsNumOfElements);
1338                  Value* ldmcsExtendedToInt32 = m_builder->CreateSExt(new_mcs_call, newLdmcsVecType);
1339  
1340                  // if ldmcs has fewer elements than new ldmcs, extend vector
1341 @@ -175,7 +175,7 @@ void ConvertMSAAPayloadTo16Bit::visitCallInst(CallInst& I)
1342                      }
1343                      auto* pMask = ConstantDataVector::get(I.getContext(), maskVals);
1344  
1345 -                    ldmcsInt32CorrectlySized = m_builder->CreateShuffleVector(ldmcsExtendedToInt32, UndefValue::get(VectorType::get(m_builder->getInt32Ty(), ldmcsNumOfElements)), pMask);
1346 +                    ldmcsInt32CorrectlySized = m_builder->CreateShuffleVector(ldmcsExtendedToInt32, UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), ldmcsNumOfElements)), pMask);
1347                  }
1348                  else
1349                  {
1350 diff --git a/IGC/Compiler/CustomSafeOptPass.cpp b/IGC/Compiler/CustomSafeOptPass.cpp
1351 index 83a6968d89..5752382ce5 100644
1352 --- a/IGC/Compiler/CustomSafeOptPass.cpp
1353 +++ b/IGC/Compiler/CustomSafeOptPass.cpp
1354 @@ -1372,7 +1372,7 @@ void IGC::CustomSafeOptPass::visitSampleBptr(llvm::SampleIntrinsic* sampleInst)
1355  bool CustomSafeOptPass::isIdentityMatrix(ExtractElementInst& I)
1356  {
1357      bool found = false;
1358 -    auto extractType = cast<VectorType>(I.getVectorOperandType());
1359 +    auto extractType = cast<IGCLLVM::FixedVectorType>(I.getVectorOperandType());
1360      auto extractTypeVecSize = (uint32_t)extractType->getNumElements();
1361      if (extractTypeVecSize == 20 ||
1362          extractTypeVecSize == 16)
1363 @@ -1601,7 +1601,7 @@ void CustomSafeOptPass::visitExtractElementInst(ExtractElementInst& I)
1364                      int elOffset = (int)(bitShift / eltSize);
1365                      elOffset = rightShift ? elOffset : -elOffset;
1366                      unsigned int newIndex = (unsigned int)((int)cstIndex->getZExtValue() + elOffset);
1367 -                    if (newIndex < cast<VectorType>(vecType)->getNumElements())
1368 +                    if (newIndex < cast<IGCLLVM::FixedVectorType>(vecType)->getNumElements())
1369                      {
1370                          IRBuilder<> builder(&I);
1371                          Value* newBitCast = builder.CreateBitCast(binOp->getOperand(0), vecType);
1372 @@ -2001,7 +2001,7 @@ void GenSpecificPattern::createBitcastExtractInsertPattern(BinaryOperator& I, Va
1373          else if (auto IEIInst = dyn_cast<InsertElementInst>(Op))
1374          {
1375              auto opType = IEIInst->getType();
1376 -            if (opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<VectorType>(opType)->getNumElements() == 2)
1377 +            if (opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<IGCLLVM::FixedVectorType>(opType)->getNumElements() == 2)
1378              {
1379                  elem = IEIInst->getOperand(1);
1380              }
1381 @@ -2064,7 +2064,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I)
1382          else if (match(&I, pattern2) && AndOp2->getType()->isIntegerTy(64))
1383          {
1384              ConstantVector* cVec = dyn_cast<ConstantVector>(VecOp);
1385 -            VectorType* vector_type = dyn_cast<VectorType>(VecOp->getType());
1386 +            IGCLLVM::FixedVectorType* vector_type = dyn_cast<IGCLLVM::FixedVectorType>(VecOp->getType());
1387              if (cVec && vector_type &&
1388                  isa<ConstantInt>(cVec->getOperand(0)) &&
1389                  cast<ConstantInt>(cVec->getOperand(0))->isZero() &&
1390 @@ -2210,7 +2210,7 @@ void GenSpecificPattern::visitBinaryOperator(BinaryOperator& I)
1391              BitCastInst* opBC = cast<BitCastInst>(op);
1392  
1393              auto opType = opBC->getType();
1394 -            if (!(opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<VectorType>(opType)->getNumElements() == 2))
1395 +            if (!(opType->isVectorTy() && cast<VectorType>(opType)->getElementType()->isIntegerTy(32) && cast<IGCLLVM::FixedVectorType>(opType)->getNumElements() == 2))
1396                  return nullptr;
1397  
1398              if (opBC->getSrcTy()->isDoubleTy())
1399 @@ -2630,8 +2630,8 @@ void GenSpecificPattern::visitBitCastInst(BitCastInst& I)
1400                  if (zExtInst->getOperand(0)->getType()->isIntegerTy(32) &&
1401                      isa<InsertElementInst>(bitCastInst->getOperand(0)) &&
1402                      bitCastInst->getOperand(0)->getType()->isVectorTy() &&
1403 -                    cast<VectorType>(bitCastInst->getOperand(0)->getType())->getElementType()->isIntegerTy(32) &&
1404 -                    cast<VectorType>(bitCastInst->getOperand(0)->getType())->getNumElements() == 2)
1405 +                    cast<IGCLLVM::FixedVectorType>(bitCastInst->getOperand(0)->getType())->getElementType()->isIntegerTy(32) &&
1406 +                    cast<IGCLLVM::FixedVectorType>(bitCastInst->getOperand(0)->getType())->getNumElements() == 2)
1407                  {
1408                      InsertElementInst* insertElementInst = cast<InsertElementInst>(bitCastInst->getOperand(0));
1409  
1410 @@ -2731,7 +2731,7 @@ void GenSpecificPattern::visitFNeg(llvm::UnaryOperator& I)
1411      }
1412      else
1413      {
1414 -        uint32_t vectorSize = cast<VectorType>(I.getType())->getNumElements();
1415 +        uint32_t vectorSize = cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements();
1416          fsub = llvm::UndefValue::get(I.getType());
1417  
1418          for (uint32_t i = 0; i < vectorSize; ++i)
1419 @@ -2845,7 +2845,7 @@ Constant* IGCConstProp::replaceShaderConstant(LoadInst* inst)
1420                  if (inst->getType()->isVectorTy())
1421                  {
1422                      Type* srcEltTy = cast<VectorType>(inst->getType())->getElementType();
1423 -                    uint32_t srcNElts = (uint32_t)cast<VectorType>(inst->getType())->getNumElements();
1424 +                    uint32_t srcNElts = (uint32_t)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements();
1425                      uint32_t eltSize_in_bytes = (unsigned int)srcEltTy->getPrimitiveSizeInBits() / 8;
1426                      IRBuilder<> builder(inst);
1427                      Value* vectorValue = UndefValue::get(inst->getType());
1428 @@ -3130,7 +3130,7 @@ Constant* IGCConstProp::ConstantFoldCmpInst(CmpInst* CI)
1429      {
1430          bool AllTrue = true, AllFalse = true;
1431          auto VecOpnd = cast<Constant>(EEI->getVectorOperand());
1432 -        unsigned N = (unsigned)cast<VectorType>(VecOpnd->getType())->getNumElements();
1433 +        unsigned N = (unsigned)cast<IGCLLVM::FixedVectorType>(VecOpnd->getType())->getNumElements();
1434          for (unsigned i = 0; i < N; ++i)
1435          {
1436              Constant* const Opnd = VecOpnd->getAggregateElement(i);
1437 @@ -3926,8 +3926,8 @@ namespace IGC
1438                  BitCastInst* BC = dyn_cast<BitCastInst>(&*BI++);
1439                  if (!BC) continue;
1440                  // Skip non-element-wise bitcast.
1441 -                VectorType* DstVTy = dyn_cast<VectorType>(BC->getType());
1442 -                VectorType* SrcVTy = dyn_cast<VectorType>(BC->getOperand(0)->getType());
1443 +                IGCLLVM::FixedVectorType* DstVTy = dyn_cast<IGCLLVM::FixedVectorType>(BC->getType());
1444 +                IGCLLVM::FixedVectorType* SrcVTy = dyn_cast<IGCLLVM::FixedVectorType>(BC->getOperand(0)->getType());
1445                  if (!DstVTy || !SrcVTy || DstVTy->getNumElements() != SrcVTy->getNumElements())
1446                      continue;
1447                  // Skip if it's not used only all extractelement.
1448 @@ -4697,7 +4697,7 @@ void SplitIndirectEEtoSel::visitExtractElementInst(llvm::ExtractElementInst& I)
1449  {
1450      using namespace llvm::PatternMatch;
1451  
1452 -    VectorType* vecTy = I.getVectorOperandType();
1453 +    IGCLLVM::FixedVectorType* vecTy = dyn_cast<IGCLLVM::FixedVectorType>(I.getVectorOperandType());
1454      uint64_t num = vecTy->getNumElements();
1455      Type* eleType = vecTy->getElementType();
1456  
1457 diff --git a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
1458 index 194696e75b..62440d6fdb 100644
1459 --- a/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
1460 +++ b/IGC/Compiler/DebugInfo/ScalarVISAModule.cpp
1461 @@ -32,6 +32,7 @@ IN THE SOFTWARE.
1462  #include "DebugInfo/DebugInfoUtils.hpp"
1463  
1464  #include "common/LLVMWarningsPush.hpp"
1465 +#include "llvmWrapper/IR/DerivedTypes.h"
1466  #include "llvm/IR/Function.h"
1467  #include "llvm/IR/Module.h"
1468  #include "common/LLVMWarningsPop.hpp"
1469 @@ -583,7 +584,7 @@ ScalarVisaModule::GetVariableLocation(const llvm::Instruction* pInst) const
1470  
1471          if (pType->isVectorTy())
1472          {
1473 -            vectorNumElements = (unsigned)cast<VectorType>(pType)->getNumElements();
1474 +            vectorNumElements = (unsigned)cast<IGCLLVM::FixedVectorType>(pType)->getNumElements();
1475          }
1476          else if (!pVar->IsUniform())
1477          {
1478 diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp
1479 index b63eaeb0f0..e6b9120de9 100644
1480 --- a/IGC/Compiler/GenTTI.cpp
1481 +++ b/IGC/Compiler/GenTTI.cpp
1482 @@ -37,6 +37,7 @@ IN THE SOFTWARE.
1483  #include "llvm/Analysis/LoopInfo.h"
1484  #include "llvm/Analysis/ScalarEvolution.h"
1485  #include "llvm/Support/raw_ostream.h"
1486 +#include "llvmWrapper/Transforms/Utils/LoopUtils.h"
1487  #include "common/LLVMWarningsPop.hpp"
1488  
1489  using namespace llvm;
1490 @@ -224,7 +225,7 @@ namespace llvm {
1491  
1492          // Skip non-simple loop.
1493          if (L->getNumBlocks() != 1) {
1494 -            if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && L->empty()) {
1495 +            if (IGC_IS_FLAG_ENABLED(EnableAdvRuntimeUnroll) && IGCLLVM::isInnermost(L)) {
1496                  auto countNonPHI = [](BasicBlock* BB) {
1497                      unsigned Total = BB->size();
1498                      unsigned PHIs = 0;
1499 diff --git a/IGC/Compiler/GenUpdateCB.cpp b/IGC/Compiler/GenUpdateCB.cpp
1500 index 9fb8362951..cbc25b484c 100644
1501 --- a/IGC/Compiler/GenUpdateCB.cpp
1502 +++ b/IGC/Compiler/GenUpdateCB.cpp
1503 @@ -24,6 +24,7 @@ IN THE SOFTWARE.
1504  
1505  #include "common/LLVMWarningsPush.hpp"
1506  #include "llvmWrapper/Bitcode/BitcodeWriter.h"
1507 +#include "llvmWrapper/IR/DerivedTypes.h"
1508  #include <llvm/Support/ScaledNumber.h>
1509  #include <llvm/Bitcode/BitcodeReader.h>
1510  #include "llvm/IR/DebugInfo.h"
1511 @@ -384,7 +385,7 @@ bool GenUpdateCB::runOnFunction(Function& F)
1512                      isResInfo(dyn_cast<GenIntrinsicInst>(inst,
1513                          GenISAIntrinsic::GenISA_resinfoptr), texId, lod, isUAV))
1514                  {
1515 -                    unsigned nelems = (unsigned)cast<VectorType>(inst->getType())->getNumElements();
1516 +                    unsigned nelems = (unsigned)cast<IGCLLVM::FixedVectorType>(inst->getType())->getNumElements();
1517                      SmallVector< SmallVector<ExtractElementInst*, 1>, 4> extracts(nelems);
1518                      if (VectorUsedByConstExtractOnly(inst, extracts))
1519                      {
1520 diff --git a/IGC/Compiler/HandleFRemInstructions.cpp b/IGC/Compiler/HandleFRemInstructions.cpp
1521 index 94995a56d8..4523f3f02d 100644
1522 --- a/IGC/Compiler/HandleFRemInstructions.cpp
1523 +++ b/IGC/Compiler/HandleFRemInstructions.cpp
1524 @@ -28,6 +28,7 @@ IN THE SOFTWARE.
1525  #include <llvm/IR/Instructions.h>
1526  #include <llvm/IR/InstIterator.h>
1527  #include <llvm/Transforms/Utils/BasicBlockUtils.h>
1528 +#include "llvmWrapper/IR/DerivedTypes.h"
1529  #include "common/LLVMWarningsPop.hpp"
1530  #include "Compiler/IGCPassSupport.h"
1531  #include "Probe/Assertion.h"
1532 @@ -77,7 +78,7 @@ void HandleFRemInstructions::visitFRem(llvm::BinaryOperator& I)
1533  
1534      if (ValType->isVectorTy())
1535      {
1536 -        auto VecCount = cast<VectorType>(ValType)->getNumElements();
1537 +        auto VecCount = cast<IGCLLVM::FixedVectorType>(ValType)->getNumElements();
1538          if (VecCount == 2 || VecCount == 3 || VecCount == 4 || VecCount == 8 || VecCount == 16)
1539          {
1540              VecStr = "v" + std::to_string(VecCount);
1541 diff --git a/IGC/Compiler/HandleLoadStoreInstructions.cpp b/IGC/Compiler/HandleLoadStoreInstructions.cpp
1542 index d18eec7311..c5535701ad 100644
1543 --- a/IGC/Compiler/HandleLoadStoreInstructions.cpp
1544 +++ b/IGC/Compiler/HandleLoadStoreInstructions.cpp
1545 @@ -77,7 +77,7 @@ void HandleLoadStoreInstructions::visitLoadInst(llvm::LoadInst& I)
1546  
1547          if (I.getType()->isVectorTy())
1548          {
1549 -            numVectorElements = (uint32_t)cast<VectorType>(I.getType())->getNumElements();
1550 +            numVectorElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements();
1551              doubleDstType = IGCLLVM::FixedVectorType::get(builder.getDoubleTy(), numVectorElements);
1552          }
1553          uint as = ptrv->getType()->getPointerAddressSpace();
1554 @@ -163,7 +163,7 @@ void HandleLoadStoreInstructions::visitStoreInst(llvm::StoreInst& I)
1555  
1556          if (I.getValueOperand()->getType()->isVectorTy())
1557          {
1558 -            numVectorElements = (uint32_t)cast<VectorType>(I.getValueOperand()->getType())->getNumElements();
1559 +            numVectorElements = (uint32_t)cast<IGCLLVM::FixedVectorType>(I.getValueOperand()->getType())->getNumElements();
1560          }
1561  
1562  
1563 diff --git a/IGC/Compiler/LegalizationPass.cpp b/IGC/Compiler/LegalizationPass.cpp
1564 index c76f3f0e1b..31e2079a9a 100644
1565 --- a/IGC/Compiler/LegalizationPass.cpp
1566 +++ b/IGC/Compiler/LegalizationPass.cpp
1567 @@ -671,7 +671,7 @@ void Legalization::visitBitCastInst(llvm::BitCastInst& I)
1568          if (!isa<TruncInst>(pZ->getOperand(0)))
1569              return;
1570  
1571 -        auto* pVecTy = cast<VectorType>(pZ->getDestTy());
1572 +        auto* pVecTy = cast<IGCLLVM::FixedVectorType>(pZ->getDestTy());
1573          if (pVecTy->getNumElements() != 3)
1574              return;
1575  
1576 @@ -766,7 +766,7 @@ void Legalization::visitSelectInst(SelectInst& I)
1577      }
1578      else if (I.getType()->isVectorTy())
1579      {
1580 -        unsigned int vecSize = (unsigned)cast<VectorType>(I.getType())->getNumElements();
1581 +        unsigned int vecSize = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements();
1582          Value* newVec = UndefValue::get(I.getType());
1583          m_builder->SetInsertPoint(&I);
1584          for (unsigned int i = 0; i < vecSize; i++)
1585 @@ -1148,7 +1148,7 @@ void Legalization::visitStoreInst(StoreInst& I)
1586      if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0)))
1587      {
1588          Value* newVec = UndefValue::get(vec->getType());
1589 -        unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1590 +        unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1591          for (unsigned int i = 0; i < nbElement; i++)
1592          {
1593              Constant* cst = vec->getElementAsConstant(i);
1594 @@ -1169,7 +1169,7 @@ void Legalization::visitStoreInst(StoreInst& I)
1595      else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0)))
1596      {
1597          Value* newVec = UndefValue::get(vec->getType());
1598 -        unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1599 +        unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1600          for (unsigned int i = 0; i < nbElement; i++)
1601          {
1602              Constant* cst = vec->getOperand(i);
1603 @@ -1190,7 +1190,7 @@ void Legalization::visitStoreInst(StoreInst& I)
1604      else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0)))
1605      {
1606          Value* newVec = UndefValue::get(vec->getType());
1607 -        unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1608 +        unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1609          for (unsigned int i = 0; i < nbElement; i++)
1610          {
1611              Constant* cst = vec->getElementValue(i);
1612 @@ -1341,7 +1341,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1613      if (ConstantDataVector * vec = dyn_cast<ConstantDataVector>(I.getOperand(0)))
1614      {
1615          Value* newVec = UndefValue::get(vec->getType());
1616 -        unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1617 +        unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1618          for (unsigned int i = 0; i < nbElement; i++)
1619          {
1620              Constant* cst = vec->getElementAsConstant(i);
1621 @@ -1361,7 +1361,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1622      else if (ConstantVector * vec = dyn_cast<ConstantVector>(I.getOperand(0)))
1623      {
1624          Value* newVec = UndefValue::get(I.getType());
1625 -        unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1626 +        unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1627          for (unsigned int i = 0; i < nbElement; i++)
1628          {
1629              Constant* cst = vec->getOperand(i);
1630 @@ -1381,7 +1381,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1631      else if (ConstantAggregateZero * vec = dyn_cast<ConstantAggregateZero>(I.getOperand(0)))
1632      {
1633          Value* newVec = UndefValue::get(I.getType());
1634 -        unsigned int nbElement = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1635 +        unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1636          for (unsigned int i = 0; i < nbElement; i++)
1637          {
1638              Constant* cst = vec->getElementValue(i);
1639 @@ -1398,7 +1398,7 @@ void Legalization::visitInsertElementInst(InsertElementInst& I)
1640      else if (I.getOperand(1)->getType()->isIntegerTy(1))
1641      {
1642          // This promotes i1 insertelement to i32
1643 -        unsigned int nbElement = (unsigned)cast<VectorType>(I.getOperand(0)->getType())->getNumElements();
1644 +        unsigned int nbElement = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getOperand(0)->getType())->getNumElements();
1645          Value* newVec = UndefValue::get(IGCLLVM::FixedVectorType::get(m_builder->getInt32Ty(), nbElement));
1646          PromoteInsertElement(&I, newVec);
1647      }
1648 @@ -1411,7 +1411,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I)
1649      // If the original vector is a constant, just use the scalar constant,
1650      // otherwise extract from the original vector.
1651  
1652 -    VectorType* resType = cast<VectorType>(I.getType());
1653 +    IGCLLVM::FixedVectorType* resType = cast<IGCLLVM::FixedVectorType>(I.getType());
1654      Value* newVec = UndefValue::get(resType);
1655      Value* src0 = I.getOperand(0);
1656      Value* src1 = I.getOperand(1);
1657 @@ -1422,7 +1422,7 @@ void Legalization::visitShuffleVectorInst(ShuffleVectorInst& I)
1658      Constant* mask = I.getShuffleMaskForBitcode();
1659  #endif
1660      // The two inputs are guaranteed to be of the same type
1661 -    VectorType* inType = cast<VectorType>(src0->getType());
1662 +    IGCLLVM::FixedVectorType* inType = cast<IGCLLVM::FixedVectorType>(src0->getType());
1663      int inCount = int_cast<int>(inType->getNumElements());
1664      int inBase = 2;  // 2 means using undef
1665      // if inType == resType, use src0/src1 as the input
1666 @@ -1638,7 +1638,7 @@ Type* Legalization::LegalAllocaType(Type* type) const
1667  #endif
1668          legalType = IGCLLVM::FixedVectorType::get(
1669              LegalAllocaType(cast<VectorType>(type)->getElementType()),
1670 -            (unsigned)cast<VectorType>(type)->getNumElements());
1671 +            (unsigned)cast<IGCLLVM::FixedVectorType>(type)->getNumElements());
1672          break;
1673      case Type::StructTyID:
1674          return LegalStructAllocaType(type);
1675 @@ -1938,7 +1938,7 @@ void Legalization::visitIntrinsicInst(llvm::IntrinsicInst& I)
1676          Value* newValue = nullptr;
1677          if (srcType->isVectorTy())
1678          {
1679 -            auto sourceVT = cast<VectorType>(srcType);
1680 +            auto sourceVT = cast<IGCLLVM::FixedVectorType>(srcType);
1681              const unsigned int numElements = (uint32_t)sourceVT->getNumElements();
1682              Value* dstVec = UndefValue::get(srcType);
1683              for (unsigned int i = 0; i < numElements; ++i)
1684 @@ -2081,7 +2081,7 @@ void Legalization::visitTruncInst(llvm::TruncInst& I) {
1685      }
1686  
1687      Src = BC->getOperand(0);
1688 -    VectorType* VTy = dyn_cast<VectorType>(Src->getType());
1689 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Src->getType());
1690      // Bail out if it's not bitcasted from <3 x i16>
1691      if (!VTy || VTy->getNumElements() != 3 || !VTy->getElementType()->isIntegerTy(16))
1692          return;
1693 diff --git a/IGC/Compiler/Legalizer/InstPromoter.cpp b/IGC/Compiler/Legalizer/InstPromoter.cpp
1694 index bba1d96d94..63cbccb53b 100644
1695 --- a/IGC/Compiler/Legalizer/InstPromoter.cpp
1696 +++ b/IGC/Compiler/Legalizer/InstPromoter.cpp
1697 @@ -25,6 +25,7 @@ IN THE SOFTWARE.
1698  #define DEBUG_TYPE "type-legalizer"
1699  #include "TypeLegalizer.h"
1700  #include "InstPromoter.h"
1701 +#include "llvmWrapper/IR/DerivedTypes.h"
1702  #include "common/LLVMWarningsPush.hpp"
1703  #include "llvm/Support/Debug.h"
1704  #include "llvm/Support/MathExtras.h"
1705 @@ -394,10 +395,10 @@ bool InstPromoter::visitBitCastInst(BitCastInst& I) {
1706          unsigned N =
1707              Val->getType()->getScalarSizeInBits() / DestTy->getScalarSizeInBits();
1708          Value* BC =
1709 -            IRB->CreateBitCast(Val, VectorType::get(DestTy->getScalarType(), N));
1710 +            IRB->CreateBitCast(Val, IGCLLVM::FixedVectorType::get(DestTy->getScalarType(), N));
1711  
1712          std::vector<Constant*> Vals;
1713 -        for (unsigned i = 0; i < DestTy->getVectorNumElements(); i++)
1714 +        for (unsigned i = 0; i < cast<IGCLLVM::FixedVectorType>(DestTy)->getNumElements(); i++)
1715              Vals.push_back(IRB->getInt32(i));
1716  
1717          Value* Mask = ConstantVector::get(Vals);
1718 diff --git a/IGC/Compiler/Legalizer/InstScalarizer.cpp b/IGC/Compiler/Legalizer/InstScalarizer.cpp
1719 index 3902f74071..c8e18cc5e7 100644
1720 --- a/IGC/Compiler/Legalizer/InstScalarizer.cpp
1721 +++ b/IGC/Compiler/Legalizer/InstScalarizer.cpp
1722 @@ -130,7 +130,7 @@ bool InstScalarizer::visitLoadInst(LoadInst& I) {
1723          // otherwise, it's broken.
1724          IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy));
1725  
1726 -        unsigned NumElts = (unsigned)cast<VectorType>(OrigTy)->getNumElements();
1727 +        unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(OrigTy)->getNumElements();
1728          unsigned Elt = 0;
1729  
1730          Type* NewPtrTy = PointerType::get(EltTy, AS);
1731 @@ -268,7 +268,7 @@ bool InstScalarizer::visitStoreInst(StoreInst& I) {
1732          // otherwise, it's broken.
1733          IGC_ASSERT(TL->getTypeSizeInBits(EltTy) == TL->getTypeStoreSizeInBits(EltTy));
1734  
1735 -        unsigned NumElts = (unsigned)cast<VectorType>(OrigTy)->getNumElements();
1736 +        unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(OrigTy)->getNumElements();
1737          unsigned Elt = 0;
1738  
1739          Type* NewPtrTy = PointerType::get(EltTy, AS);
1740 @@ -498,7 +498,7 @@ bool InstScalarizer::visitInsertElementInst(InsertElementInst& I) {
1741      IGC_ASSERT(EltSeq->size());
1742      IGC_ASSERT(VecSeqCopy.size() % EltSeq->size() == 0);
1743  
1744 -    unsigned NumElts = (unsigned)cast<VectorType>(I.getOperand(0)->getType())->getNumElements();
1745 +    unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(I.getOperand(0)->getType())->getNumElements();
1746      unsigned i = 0;
1747      for (unsigned Elt = 0; Elt != NumElts; ++Elt) {
1748          if (Elt == Idx) {
1749 diff --git a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
1750 index 28f8ce840f..778132c4f2 100644
1751 --- a/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
1752 +++ b/IGC/Compiler/Legalizer/PeepholeTypeLegalizer.cpp
1753 @@ -162,7 +162,7 @@ void PeepholeTypeLegalizer::legalizePhiInstruction(Instruction& I)
1754  
1755      if (quotient > 1)
1756      {
1757 -        unsigned numElements = I.getType()->isVectorTy() ? (unsigned)cast<VectorType>(I.getType())->getNumElements() : 1;
1758 +        unsigned numElements = I.getType()->isVectorTy() ? (unsigned)cast<IGCLLVM::FixedVectorType>(I.getType())->getNumElements() : 1;
1759          Type* newType = IGCLLVM::FixedVectorType::get(Type::getIntNTy(I.getContext(), promoteToInt), quotient * numElements);
1760  
1761          PHINode* newPhi = m_builder->CreatePHI(newType, oldPhi->getNumIncomingValues());
1762 @@ -223,7 +223,7 @@ void PeepholeTypeLegalizer::legalizeExtractElement(Instruction& I)
1763      unsigned elementWidth = extract->getType()->getScalarSizeInBits();
1764      if (!isLegalInteger(elementWidth) && extract->getType()->isIntOrIntVectorTy())
1765      {
1766 -        unsigned numElements = (unsigned)cast<VectorType>(extract->getOperand(0)->getType())->getNumElements();
1767 +        unsigned numElements = (unsigned)cast<IGCLLVM::FixedVectorType>(extract->getOperand(0)->getType())->getNumElements();
1768          unsigned quotient, promoteToInt;
1769          promoteInt(elementWidth, quotient, promoteToInt, DL->getLargestLegalIntTypeSizeInBits());
1770  
1771 @@ -850,7 +850,7 @@ void PeepholeTypeLegalizer::cleanupZExtInst(Instruction& I) {
1772          }
1773  
1774          unsigned ipElmtSize = prevInst->getOperand(0)->getType()->getScalarSizeInBits();
1775 -        unsigned ipVecSize = (unsigned)cast<VectorType>(prevInst->getOperand(0)->getType())->getNumElements();
1776 +        unsigned ipVecSize = (unsigned)cast<IGCLLVM::FixedVectorType>(prevInst->getOperand(0)->getType())->getNumElements();
1777          unsigned convFactor = promoteToInt / ipElmtSize;
1778  
1779          Value* vecRes = UndefValue::get(IGCLLVM::FixedVectorType::get(llvm::Type::getIntNTy(I.getContext(), promoteToInt), quotient));
1780 diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.cpp b/IGC/Compiler/Legalizer/TypeLegalizer.cpp
1781 index f8f71d71dd..a46f42bd0d 100644
1782 --- a/IGC/Compiler/Legalizer/TypeLegalizer.cpp
1783 +++ b/IGC/Compiler/Legalizer/TypeLegalizer.cpp
1784 @@ -32,6 +32,7 @@ IN THE SOFTWARE.
1785  #include "InstScalarizer.h"
1786  #include "InstElementizer.h"
1787  #include "common/LLVMWarningsPush.hpp"
1788 +#include "llvmWrapper/IR/DerivedTypes.h"
1789  #include "llvm/ADT/PostOrderIterator.h"
1790  #include "llvm/IR/CFG.h"
1791  #include "llvm/Support/Debug.h"
1792 @@ -290,7 +291,7 @@ TypeSeq* TypeLegalizer::getScalarizedTypeSeq(Type* Ty) {
1793      }
1794  
1795      Type* EltTy = cast<VectorType>(Ty)->getElementType();
1796 -    for (unsigned i = 0, e = (unsigned)cast<VectorType>(Ty)->getNumElements(); i != e; ++i)
1797 +    for (unsigned i = 0, e = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements(); i != e; ++i)
1798          TMI->second.push_back(EltTy);
1799  
1800      return &TMI->second;
1801 diff --git a/IGC/Compiler/Legalizer/TypeLegalizer.h b/IGC/Compiler/Legalizer/TypeLegalizer.h
1802 index f3ce264ce8..a6910d0876 100644
1803 --- a/IGC/Compiler/Legalizer/TypeLegalizer.h
1804 +++ b/IGC/Compiler/Legalizer/TypeLegalizer.h
1805 @@ -28,6 +28,7 @@ IN THE SOFTWARE.
1806  #include "llvmWrapper/IR/Instructions.h"
1807  #include "llvmWrapper/Analysis/InlineCost.h"
1808  #include "llvmWrapper/IR/InstrTypes.h"
1809 +#include "llvmWrapper/IR/DerivedTypes.h"
1810  #include "llvmWrapper/Support/Alignment.h"
1811  #include "llvm/ADT/ArrayRef.h"
1812  #include "llvm/ADT/DenseMap.h"
1813 @@ -287,7 +288,7 @@ namespace IGC {
1814                  if (!Ty->isVectorTy())
1815                      return false;
1816  
1817 -                unsigned NumElts = (unsigned)cast<VectorType>(Ty)->getNumElements();
1818 +                unsigned NumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements();
1819                  Type* EltTy = cast<VectorType>(Ty)->getElementType();
1820                  const auto& ProfitLengths = getProfitLoadVectorLength(EltTy);
1821  
1822 diff --git a/IGC/Compiler/LowPrecisionOptPass.cpp b/IGC/Compiler/LowPrecisionOptPass.cpp
1823 index 0708bfae58..15272b8dfc 100644
1824 --- a/IGC/Compiler/LowPrecisionOptPass.cpp
1825 +++ b/IGC/Compiler/LowPrecisionOptPass.cpp
1826 @@ -252,7 +252,7 @@ bool LowPrecisionOpt::propagateSamplerType(llvm::GenIntrinsicInst& I)
1827          return false;
1828      }
1829  
1830 -    VectorType* oldTy = cast<VectorType>(I.getType());
1831 +    IGCLLVM::FixedVectorType* oldTy = cast<IGCLLVM::FixedVectorType>(I.getType());
1832      llvm::SmallVector<llvm::Type*, 4> overloadTys;
1833      auto retTy = IGCLLVM::FixedVectorType::get(newDstType, int_cast<unsigned int>(oldTy->getNumElements()));
1834      overloadTys.push_back(retTy);
1835 diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
1836 index 67535cfcda..3cdd2975f7 100644
1837 --- a/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
1838 +++ b/IGC/Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.cpp
1839 @@ -24,6 +24,7 @@ IN THE SOFTWARE.
1840  
1841  #include "Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.hpp"
1842  #include "Compiler/IGCPassSupport.h"
1843 +#include "llvmWrapper/IR/DerivedTypes.h"
1844  #include "common/LLVMWarningsPush.hpp"
1845  #include "llvm/IR/Function.h"
1846  #include "common/LLVMWarningsPop.hpp"
1847 @@ -130,7 +131,7 @@ static uint64_t getNumElements(Type* type)
1848      {
1849          return arrayType->getNumElements();
1850      }
1851 -    if (VectorType * vectorType = dyn_cast<VectorType>(type))
1852 +    if (IGCLLVM::FixedVectorType * vectorType = dyn_cast<IGCLLVM::FixedVectorType>(type))
1853      {
1854          return vectorType->getNumElements();
1855      }
1856 diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
1857 index 2a9d749959..79ed0948c0 100644
1858 --- a/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
1859 +++ b/IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.cpp
1860 @@ -27,6 +27,7 @@ IN THE SOFTWARE.
1861  #include "Compiler/IGCPassSupport.h"
1862  #include "GenISAIntrinsics/GenIntrinsicInst.h"
1863  
1864 +#include "llvmWrapper/IR/DerivedTypes.h"
1865  #include "common/LLVMWarningsPush.hpp"
1866  #include <llvm/IR/Function.h>
1867  #include <llvm/IR/Instructions.h>
1868 @@ -133,7 +134,7 @@ Value* CorrectlyRoundedDivSqrt::emitIEEEDivide(BinaryOperator* I, Value* Op0, Va
1869      }
1870      else
1871      {
1872 -        auto vType = dyn_cast<VectorType>(Ty);
1873 +        auto vType = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
1874          unsigned VecLen = (uint32_t)vType->getNumElements();
1875          Divide = UndefValue::get(Ty);
1876          for (unsigned i = 0; i < VecLen; i++)
1877 diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
1878 index 52a9b61355..5ad3ceda43 100644
1879 --- a/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
1880 +++ b/IGC/Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/TransformBlocks.cpp
1881 @@ -952,7 +952,7 @@ namespace //Anonymous
1882          {
1883              auto ndrangeStructName = "struct.ndrange_t";
1884              auto module = _deviceExecCall->getModule();
1885 -            auto ndrangeTy = module->getTypeByName(ndrangeStructName);
1886 +            auto ndrangeTy = IGCLLVM::getTypeByName(module, ndrangeStructName);
1887              if (ndrangeTy == nullptr)
1888              {
1889                  //create struct type
1890 @@ -1697,7 +1697,7 @@ namespace //Anonymous
1891                      // this generates <element_type><num_elements> string. Ie for char2 element_type is char and num_elements is 2
1892                      // that is done by callin BaseTypeName on vector element type, this recursive call has only a depth of one since
1893                      // there are no compound vectors in OpenCL.
1894 -                    auto vType = llvm::dyn_cast<VectorType>(type);
1895 +                    auto vType = llvm::dyn_cast<IGCLLVM::FixedVectorType>(type);
1896                      return BaseTypeName(type->getContainedType(0), os) << vType->getNumElements();
1897                  }
1898                  default:
1899 diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
1900 index 6448463d7d..7df7107961 100644
1901 --- a/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
1902 +++ b/IGC/Compiler/Optimizer/OpenCLPasses/KernelArgs.cpp
1903 @@ -24,6 +24,7 @@ IN THE SOFTWARE.
1904  
1905  #include "Compiler/Optimizer/OpenCLPasses/KernelArgs.hpp"
1906  #include "AdaptorCommon/ImplicitArgs.hpp"
1907 +#include "llvmWrapper/IR/DerivedTypes.h"
1908  #include "common/LLVMWarningsPush.hpp"
1909  #include <llvm/IR/Argument.h>
1910  #include <llvm/IR/DataLayout.h>
1911 @@ -388,7 +389,7 @@ unsigned int KernelArg::calcAssociatedArgNo(const ImplicitArg& implicitArg, cons
1912  
1913  unsigned int KernelArg::getNumComponents() const
1914  {
1915 -    if (VectorType * vecType = dyn_cast<VectorType>(m_arg->getType()))
1916 +    if (IGCLLVM::FixedVectorType * vecType = dyn_cast<IGCLLVM::FixedVectorType>(m_arg->getType()))
1917      {
1918          // Vector
1919          return int_cast<unsigned int>(vecType->getNumElements());
1920 diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
1921 index 407748533e..9f375e1cb7 100644
1922 --- a/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
1923 +++ b/IGC/Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.cpp
1924 @@ -739,7 +739,7 @@ Value* OpenCLPrintfResolution::fixupPrintfArg(CallInst& printfCall, Value* arg,
1925              }
1926  
1927              Type* newType = Type::getFloatTy(arg->getContext());
1928 -            if (auto argVT = dyn_cast<VectorType>(arg->getType()))
1929 +            if (auto argVT = dyn_cast<IGCLLVM::FixedVectorType>(arg->getType()))
1930              {
1931                  newType = IGCLLVM::FixedVectorType::get(newType, (unsigned)argVT->getNumElements());
1932              }
1933 @@ -769,7 +769,7 @@ void OpenCLPrintfResolution::preprocessPrintfArgs(CallInst& printfCall)
1934          IGC::SHADER_PRINTF_TYPE argDataType = getPrintfArgDataType(arg);
1935          arg = fixupPrintfArg(printfCall, arg, argDataType);
1936          uint vecSize = 0;
1937 -        if (auto argVType = dyn_cast<VectorType>(argType)) {
1938 +        if (auto argVType = dyn_cast<IGCLLVM::FixedVectorType>(argType)) {
1939              vecSize = (uint)argVType->getNumElements();
1940          }
1941          m_argDescriptors.push_back(SPrintfArgDescriptor(argDataType, arg, vecSize));
1942 diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
1943 index 03a4583771..0bade5aa7c 100644
1944 --- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
1945 +++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp
1946 @@ -29,6 +29,7 @@ IN THE SOFTWARE.
1947  #include "Compiler/IGCPassSupport.h"
1948  #include "Compiler/CISACodeGen/GenCodeGenModule.h"
1949  #include "Compiler/CISACodeGen/LowerGEPForPrivMem.hpp"
1950 +#include "llvmWrapper/IR/DerivedTypes.h"
1951  #include "common/LLVMWarningsPush.hpp"
1952  #include "llvm/Transforms/Utils/Local.h"
1953  #include "llvm/IR/DataLayout.h"
1954 @@ -614,7 +615,7 @@ class TransposeHelperPrivateMem : public TransposeHelper
1955              Type* scalarptrTy = PointerType::get(scalarType, pLoad->getPointerAddressSpace());
1956              IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
1957              Value* vec = UndefValue::get(pLoad->getType());
1958 -            auto pLoadVT = cast<VectorType>(pLoad->getType());
1959 +            auto pLoadVT = cast<IGCLLVM::FixedVectorType>(pLoad->getType());
1960              for (unsigned i = 0, e = (unsigned)pLoadVT->getNumElements(); i < e; ++i)
1961              {
1962                  Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy);
1963 @@ -653,7 +654,7 @@ class TransposeHelperPrivateMem : public TransposeHelper
1964              IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
1965              Value* vec = pStore->getValueOperand();
1966  
1967 -            unsigned vecNumElts = (unsigned)cast<VectorType>(vec->getType())->getNumElements();
1968 +            unsigned vecNumElts = (unsigned)cast<IGCLLVM::FixedVectorType>(vec->getType())->getNumElements();
1969              for (unsigned i = 0; i < vecNumElts; ++i)
1970              {
1971                  Value* ptr = IRB.CreateIntToPtr(address, scalarptrTy);
1972 @@ -717,7 +718,7 @@ bool PrivateMemoryResolution::testTransposedMemory(const Type* pTmpType, const T
1973          }
1974          else if(pTmpType->isVectorTy())
1975          {
1976 -            auto pTmpVType = cast<VectorType>(pTmpType);
1977 +            auto pTmpVType = cast<IGCLLVM::FixedVectorType>(pTmpType);
1978              tmpAllocaSize *= pTmpVType->getNumElements();
1979              pTmpType = pTmpType->getContainedType(0);
1980              ok = (nullptr != pTmpType);
1981 @@ -825,6 +826,8 @@ bool PrivateMemoryResolution::resolveAllocaInstructions(bool privateOnStack)
1982  
1983      // Construct an empty DebugLoc.
1984      IF_DEBUG_INFO(DebugLoc entryDebugLoc);
1985 +    // Assign with the function location if available.
1986 +    IF_DEBUG_INFO_IF(DISubprogram *subprogram = m_currFunction->getSubprogram(), entryDebugLoc = DILocation::get(subprogram->getContext(), subprogram->getLine(), 0, subprogram););
1987      IF_DEBUG_INFO(entryBuilder.SetCurrentDebugLocation(entryDebugLoc));
1988  
1989      if (privateOnStack)
1990 diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
1991 index 1190330abc..bb2932d5da 100644
1992 --- a/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
1993 +++ b/IGC/Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.cpp
1994 @@ -254,7 +254,7 @@ Instruction* ReplaceUnsupportedIntrinsics::insertLoop(Instruction* Loc, Value* L
1995  Value* ReplaceUnsupportedIntrinsics::replicateScalar(
1996      Value* ScalarVal, Type* Ty, Instruction* InsertBefore)
1997  {
1998 -    VectorType* VTy = dyn_cast<VectorType>(Ty);
1999 +    IGCLLVM::FixedVectorType* VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
2000      Type* ETy = VTy ? VTy->getElementType() : Ty;
2001      uint32_t sBits = (unsigned int)ScalarVal->getType()->getPrimitiveSizeInBits();
2002      uint32_t nBits = (unsigned int)ETy->getPrimitiveSizeInBits();
2003 @@ -915,7 +915,7 @@ void ReplaceUnsupportedIntrinsics::replaceFunnelShift(IntrinsicInst* I) {
2004      }
2005  
2006      Value* numBits = Builder.getIntN(sizeInBits, sizeInBits);
2007 -    if (auto IVT = dyn_cast<VectorType>(I->getType())) {
2008 +    if (auto IVT = dyn_cast<IGCLLVM::FixedVectorType>(I->getType())) {
2009          numBits = ConstantVector::getSplat(IGCLLVM::getElementCount((uint32_t)IVT->getNumElements()), cast<Constant>(numBits));
2010      }
2011      auto shiftModulo = Builder.CreateURem(I->getArgOperand(2), numBits);
2012 diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
2013 index c9fed6746b..1882a8cc1f 100644
2014 --- a/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
2015 +++ b/IGC/Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.cpp
2016 @@ -291,7 +291,7 @@ static Value* BuildLoadInst(CallInst& CI, unsigned int Offset, Type* DataType)
2017      auto Size = ElemByteSize;
2018      if (DataType->isVectorTy())
2019      {
2020 -        Size *= DataType->getVectorNumElements();
2021 +        Size *= (unsigned int)cast<IGCLLVM::FixedVectorType>(DataType)->getNumElements();
2022      }
2023      unsigned int AlignedOffset = (Offset / ElemByteSize) * ElemByteSize;
2024      unsigned int LoadByteSize = (Offset == AlignedOffset) ? Size : Size * 2;
2025 diff --git a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
2026 index 9a77ec5386..09efed958d 100644
2027 --- a/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
2028 +++ b/IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp
2029 @@ -341,7 +341,7 @@ bool PreCompiledFuncImport::preProcessDouble()
2030                      }
2031                      else
2032                      {
2033 -                        uint32_t vectorSize = cast<VectorType>(Inst->getType())->getNumElements();
2034 +                        uint32_t vectorSize = cast<IGCLLVM::FixedVectorType>(Inst->getType())->getNumElements();
2035                          fsub = llvm::UndefValue::get(Inst->getType());
2036  
2037                          for (uint32_t i = 0; i < vectorSize; ++i)
2038 @@ -967,7 +967,7 @@ void PreCompiledFuncImport::processDivide(BinaryOperator& inst, EmulatedFunction
2039  
2040      Type* argumentType = inst.getOperand(0)->getType();
2041  
2042 -    if (auto argumentVType = dyn_cast<VectorType>(argumentType))
2043 +    if (auto argumentVType = dyn_cast<IGCLLVM::FixedVectorType>(argumentType))
2044      {
2045          numElements = (unsigned)argumentVType->getNumElements();
2046      }
2047 diff --git a/IGC/Compiler/Optimizer/Scalarizer.cpp b/IGC/Compiler/Optimizer/Scalarizer.cpp
2048 index 09e1cc9858..3882f4140e 100644
2049 --- a/IGC/Compiler/Optimizer/Scalarizer.cpp
2050 +++ b/IGC/Compiler/Optimizer/Scalarizer.cpp
2051 @@ -419,7 +419,7 @@ void ScalarizeFunction::scalarizeInstruction(BinaryOperator* BI)
2052  {
2053      V_PRINT(scalarizer, "\t\tBinary instruction\n");
2054      IGC_ASSERT_MESSAGE(BI, "instruction type dynamic cast failed");
2055 -    VectorType* instType = dyn_cast<VectorType>(BI->getType());
2056 +    IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(BI->getType());
2057      // Only need handling for vector binary ops
2058      if (!instType) return;
2059  
2060 @@ -479,7 +479,7 @@ void ScalarizeFunction::scalarizeInstruction(CmpInst* CI)
2061  {
2062      V_PRINT(scalarizer, "\t\tCompare instruction\n");
2063      IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed");
2064 -    VectorType* instType = dyn_cast<VectorType>(CI->getType());
2065 +    IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getType());
2066      // Only need handling for vector compares
2067      if (!instType) return;
2068  
2069 @@ -527,13 +527,13 @@ void ScalarizeFunction::scalarizeInstruction(CastInst* CI)
2070  {
2071      V_PRINT(scalarizer, "\t\tCast instruction\n");
2072      IGC_ASSERT_MESSAGE(CI, "instruction type dynamic cast failed");
2073 -    VectorType* instType = dyn_cast<VectorType>(CI->getType());
2074 +    IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getType());
2075  
2076      // For BitCast - we only scalarize if src and dst types have same vector length
2077      if (isa<BitCastInst>(CI))
2078      {
2079          if (!instType) return recoverNonScalarizableInst(CI);
2080 -        VectorType* srcType = dyn_cast<VectorType>(CI->getOperand(0)->getType());
2081 +        IGCLLVM::FixedVectorType* srcType = dyn_cast<IGCLLVM::FixedVectorType>(CI->getOperand(0)->getType());
2082          if (!srcType || (instType->getNumElements() != srcType->getNumElements()))
2083          {
2084              return recoverNonScalarizableInst(CI);
2085 @@ -588,7 +588,7 @@ void ScalarizeFunction::scalarizeInstruction(PHINode* PI)
2086  {
2087      V_PRINT(scalarizer, "\t\tPHI instruction\n");
2088      IGC_ASSERT_MESSAGE(PI, "instruction type dynamic cast failed");
2089 -    VectorType* instType = dyn_cast<VectorType>(PI->getType());
2090 +    IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(PI->getType());
2091      // Only need handling for vector PHI
2092      if (!instType) return;
2093  
2094 @@ -699,7 +699,7 @@ void ScalarizeFunction::scalarizeInstruction(SelectInst* SI)
2095  {
2096      V_PRINT(scalarizer, "\t\tSelect instruction\n");
2097      IGC_ASSERT_MESSAGE(SI, "instruction type dynamic cast failed");
2098 -    VectorType* instType = dyn_cast<VectorType>(SI->getType());
2099 +    IGCLLVM::FixedVectorType* instType = dyn_cast<IGCLLVM::FixedVectorType>(SI->getType());
2100      // Only need handling for vector select
2101      if (!instType) return;
2102  
2103 @@ -781,7 +781,7 @@ void ScalarizeFunction::scalarizeInstruction(ExtractElementInst* EI)
2104  
2105      // Connect the "extracted" value to all its consumers
2106      uint64_t scalarIndex = cast<ConstantInt>(scalarIndexVal)->getZExtValue();
2107 -    auto valueVType = cast<VectorType>(vectorValue->getType());
2108 +    auto valueVType = cast<IGCLLVM::FixedVectorType>(vectorValue->getType());
2109      if (static_cast<unsigned int>(scalarIndex) < (unsigned)valueVType->getNumElements())
2110      {
2111          IGC_ASSERT_MESSAGE(NULL != operand[static_cast<unsigned int>(scalarIndex)], "SCM error");
2112 @@ -845,7 +845,7 @@ void ScalarizeFunction::scalarizeInstruction(InsertElementInst* II)
2113      if (isa<UndefValue>(sourceVectorValue))
2114      {
2115          // Scalarize the undef value (generate a scalar undef)
2116 -        VectorType* inputVectorType = dyn_cast<VectorType>(sourceVectorValue->getType());
2117 +        IGCLLVM::FixedVectorType* inputVectorType = dyn_cast<IGCLLVM::FixedVectorType>(sourceVectorValue->getType());
2118          IGC_ASSERT_MESSAGE(inputVectorType, "expected vector argument");
2119  
2120          UndefValue* undefVal = UndefValue::get(inputVectorType->getElementType());
2121 @@ -886,7 +886,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
2122      IGC_ASSERT(nullptr != sourceVector0Value);
2123      Value* sourceVector1Value = SI->getOperand(1);
2124      IGC_ASSERT(nullptr != sourceVector1Value);
2125 -    VectorType* const inputType = dyn_cast<VectorType>(sourceVector0Value->getType());
2126 +    IGCLLVM::FixedVectorType* const inputType = dyn_cast<IGCLLVM::FixedVectorType>(sourceVector0Value->getType());
2127      IGC_ASSERT_MESSAGE(nullptr != inputType, "vector input error");
2128      IGC_ASSERT_MESSAGE(inputType == sourceVector1Value->getType(), "vector input error");
2129      unsigned sourceVectorWidth = int_cast<unsigned>(inputType->getNumElements());
2130 @@ -908,7 +908,7 @@ void ScalarizeFunction::scalarizeInstruction(ShuffleVectorInst* SI)
2131  
2132      // Generate array for shuffled scalar values
2133      SmallVector<Value*, MAX_INPUT_VECTOR_WIDTH>newVector;
2134 -    unsigned width = int_cast<unsigned>(SI->getType()->getNumElements());
2135 +    unsigned width = int_cast<unsigned>(cast<IGCLLVM::FixedVectorType>(SI->getType())->getNumElements());
2136  
2137      // Generate undef value, which may be needed as some scalar elements
2138      UndefValue* undef = UndefValue::get(inputType->getElementType());
2139 @@ -977,7 +977,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI)
2140  
2141      if (baseValue->getType()->isVectorTy())
2142      {
2143 -        width = int_cast<unsigned>(dyn_cast<VectorType>(baseValue->getType())->getNumElements());
2144 +        width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(baseValue->getType())->getNumElements());
2145          // Obtain the scalarized operands
2146          obtainScalarizedValues(operand1, NULL, baseValue, GI);
2147          ptrTy = dyn_cast<VectorType>(baseValue->getType())->getElementType();
2148 @@ -988,7 +988,7 @@ void ScalarizeFunction::scalarizeInstruction(GetElementPtrInst* GI)
2149      }
2150      if (indexValue->getType()->isVectorTy())
2151      {
2152 -        width = int_cast<unsigned>(dyn_cast<VectorType>(indexValue->getType())->getNumElements());
2153 +        width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(indexValue->getType())->getNumElements());
2154          // Obtain the scalarized operands
2155          obtainScalarizedValues(operand2, NULL, indexValue, GI);
2156      }
2157 @@ -1027,7 +1027,7 @@ void ScalarizeFunction::obtainScalarizedValues(SmallVectorImpl<Value*>& retValue
2158  {
2159      V_PRINT(scalarizer, "\t\t\tObtaining scalar value... " << *origValue << "\n");
2160  
2161 -    VectorType* origType = dyn_cast<VectorType>(origValue->getType());
2162 +    IGCLLVM::FixedVectorType* origType = dyn_cast<IGCLLVM::FixedVectorType>(origValue->getType());
2163      IGC_ASSERT_MESSAGE(origType, "Value must have a vector type!");
2164      unsigned width = int_cast<unsigned>(origType->getNumElements());
2165  
2166 @@ -1186,7 +1186,7 @@ void ScalarizeFunction::obtainVectorValueWhichMightBeScalarizedImpl(Value* vecto
2167      }
2168  
2169      Value* assembledVector = UndefValue::get(vectorVal->getType());
2170 -    unsigned width = int_cast<unsigned>(dyn_cast<VectorType>(vectorVal->getType())->getNumElements());
2171 +    unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(vectorVal->getType())->getNumElements());
2172      for (unsigned i = 0; i < width; i++)
2173      {
2174          IGC_ASSERT_MESSAGE(NULL != valueEntry->scalarValues[i], "SCM entry has NULL value");
2175 @@ -1246,7 +1246,7 @@ void ScalarizeFunction::updateSCMEntryWithValues(ScalarizeFunction::SCMEntry* en
2176      bool matchDbgLoc)
2177  {
2178      IGC_ASSERT_MESSAGE((origValue->getType()->isArrayTy() || origValue->getType()->isVectorTy()), "only Vector values are supported");
2179 -    unsigned width = int_cast<unsigned>(dyn_cast<VectorType>(origValue->getType())->getNumElements());
2180 +    unsigned width = int_cast<unsigned>(dyn_cast<IGCLLVM::FixedVectorType>(origValue->getType())->getNumElements());
2181  
2182      entry->isOriginalVectorRemoved = isOrigValueRemoved;
2183  
2184 @@ -1316,7 +1316,7 @@ void ScalarizeFunction::resolveDeferredInstructions()
2185          Instruction* vectorInst = dyn_cast<Instruction>(current.unresolvedInst);
2186          IGC_ASSERT_MESSAGE(vectorInst, "DRL only handles unresolved instructions");
2187  
2188 -        VectorType* currType = dyn_cast<VectorType>(vectorInst->getType());
2189 +        IGCLLVM::FixedVectorType* currType = dyn_cast<IGCLLVM::FixedVectorType>(vectorInst->getType());
2190          IGC_ASSERT_MESSAGE(currType, "Cannot have DRL of non-vector value");
2191          unsigned width = int_cast<unsigned>(currType->getNumElements());
2192  
2193 diff --git a/IGC/Compiler/Optimizer/ValueTracker.cpp b/IGC/Compiler/Optimizer/ValueTracker.cpp
2194 index ac02746e3f..8c0619edcc 100644
2195 --- a/IGC/Compiler/Optimizer/ValueTracker.cpp
2196 +++ b/IGC/Compiler/Optimizer/ValueTracker.cpp
2197 @@ -178,7 +178,7 @@ Value* ValueTracker::handleExtractElement(ExtractElementInst* E)
2198          {
2199              auto mask = I->getShuffleMask();
2200              uint shuffleidx = int_cast<uint>(mask[(uint)idx]);
2201 -            auto vType = dyn_cast<VectorType>(I->getOperand(0)->getType());
2202 +            auto vType = dyn_cast<IGCLLVM::FixedVectorType>(I->getOperand(0)->getType());
2203              baseValue = (shuffleidx < vType->getNumElements()) ?
2204                  I->getOperand(0) : I->getOperand(1);
2205          }
2206 diff --git a/IGC/Compiler/VerificationPass.cpp b/IGC/Compiler/VerificationPass.cpp
2207 index 98437d79dd..40d50f5a19 100644
2208 --- a/IGC/Compiler/VerificationPass.cpp
2209 +++ b/IGC/Compiler/VerificationPass.cpp
2210 @@ -302,7 +302,7 @@ bool VerificationPass::verifyType(Type* type, Value* val)
2211  
2212      case IGCLLVM::VectorTyID:
2213      {
2214 -        auto VType = cast<VectorType>(type);
2215 +        auto VType = cast<IGCLLVM::FixedVectorType>(type);
2216          unsigned typeSize = (unsigned)VType->getNumElements();
2217          if (!m_IGC_IR_spec.vectorTypeSizes.count(typeSize))
2218          {
2219 diff --git a/IGC/DebugInfo/DebugInfoUtils.hpp b/IGC/DebugInfo/DebugInfoUtils.hpp
2220 index 7f2e288acd..88b30a75ff 100644
2221 --- a/IGC/DebugInfo/DebugInfoUtils.hpp
2222 +++ b/IGC/DebugInfo/DebugInfoUtils.hpp
2223 @@ -108,7 +108,7 @@ namespace IGC
2224                  IGCLLVM::DIBuilder Builder(M);
2225                  llvm::DIGlobalVariable* GV = GVs[j]->getVariable();
2226                  llvm::DIScope* scopeToUse = GV->getScope();
2227 -                llvm::DILocation* locToUse = llvm::DebugLoc::get(GV->getLine(), 0, scopeToUse, loc);
2228 +                llvm::DILocation* locToUse = llvm::DILocation::get(scopeToUse->getContext(), GV->getLine(), 0, scopeToUse, loc);
2229                  if (llvm::isa<llvm::DICompileUnit>(GV->getScope()))
2230                  {
2231                      // Function has no DebugLoc so it is either internal
2232 diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp
2233 index e86ea69a5c..b251531b21 100644
2234 --- a/IGC/DebugInfo/DwarfDebug.cpp
2235 +++ b/IGC/DebugInfo/DwarfDebug.cpp
2236 @@ -2168,9 +2168,9 @@ static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext& Ctx)
2237          // Check for number of operands since the compatibility is cheap here.
2238          if (SP->getNumOperands() > 19)
2239          {
2240 -            return DebugLoc::get(SP->getScopeLine(), 0, SP);
2241 +            return DILocation::get(SP->getContext(), SP->getScopeLine(), 0, SP);
2242          }
2243 -        return DebugLoc::get(SP->getLine(), 0, SP);
2244 +        return DILocation::get(SP->getContext(), SP->getLine(), 0, SP);
2245      }
2246  
2247      return DebugLoc();
2248 diff --git a/IGC/GenISAIntrinsics/GenIntrinsics.cpp b/IGC/GenISAIntrinsics/GenIntrinsics.cpp
2249 index 708cfdaa6a..772155b214 100644
2250 --- a/IGC/GenISAIntrinsics/GenIntrinsics.cpp
2251 +++ b/IGC/GenISAIntrinsics/GenIntrinsics.cpp
2252 @@ -204,7 +204,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos,
2253    case IITDescriptor::SameVecWidthArgument: {
2254      Type *EltTy = DecodeFixedType(Infos, Tys, Context);
2255      Type *Ty = Tys[D.getArgumentNumber()];
2256 -    if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
2257 +    if (IGCLLVM::FixedVectorType *VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty)) {
2258        return IGCLLVM::FixedVectorType::get(EltTy, int_cast<unsigned int>(VTy->getNumElements()));
2259      }
2260      IGC_ASSERT_EXIT_MESSAGE(0, "unhandled");
2261 @@ -215,7 +215,7 @@ static Type *DecodeFixedType(ArrayRef<GenISAIntrinsic::IITDescriptor> &Infos,
2262    }
2263    case IITDescriptor::VecOfPtrsToElt: {
2264        Type *Ty = Tys[D.getArgumentNumber()];
2265 -      VectorType *VTy = dyn_cast<VectorType>(Ty);
2266 +      IGCLLVM::FixedVectorType *VTy = dyn_cast<IGCLLVM::FixedVectorType>(Ty);
2267        if (!VTy)
2268            IGC_ASSERT_EXIT_MESSAGE(0, "Expected an argument of Vector Type");
2269        Type *EltTy = cast<VectorType>(VTy)->getElementType();
2270 @@ -434,7 +434,7 @@ static std::string getMangledTypeStr(Type* Ty) {
2271      Result += "f";
2272    }
2273    else if (isa<VectorType>(Ty))
2274 -    Result += "v" + utostr(cast<VectorType>(Ty)->getNumElements()) +
2275 +    Result += "v" + utostr(cast<IGCLLVM::FixedVectorType>(Ty)->getNumElements()) +
2276        getMangledTypeStr(cast<VectorType>(Ty)->getElementType());
2277    else if (Ty)
2278      Result += EVT::getEVT(Ty).getEVTString();
2279 diff --git a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
2280 index af20473ff4..79f74d3301 100644
2281 --- a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
2282 +++ b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp
2283 @@ -4989,7 +4989,7 @@ void LLVM3DBuilder<preserveNames, T, Inserter>::VectorToScalars(
2284      IGC_ASSERT(nullptr != vector->getType());
2285      IGC_ASSERT(vector->getType()->isVectorTy());
2286  
2287 -    const unsigned count = (unsigned)llvm::cast<llvm::VectorType>(vector->getType())->getNumElements();
2288 +    const unsigned count = (unsigned)llvm::cast<IGCLLVM::FixedVectorType>(vector->getType())->getNumElements();
2289      IGC_ASSERT(1 < count);
2290      IGC_ASSERT(count <= 4);
2291      IGC_ASSERT(count <= maxSize);
2292 diff --git a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
2293 index 8b67bdf410..307eeaf907 100644
2294 --- a/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
2295 +++ b/IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h
2296 @@ -27,6 +27,7 @@ IN THE SOFTWARE.
2297  
2298  #include "llvm/Config/llvm-config.h"
2299  #include "llvm/IR/DerivedTypes.h"
2300 +#include "llvm/IR/Module.h"
2301  
2302  namespace IGCLLVM
2303  {
2304 @@ -60,6 +61,15 @@ namespace IGCLLVM
2305          return false;
2306  #endif
2307      }
2308 +
2309 +    inline llvm::StructType *getTypeByName(llvm::Module *M, llvm::StringRef Name) {
2310 +#if LLVM_VERSION_MAJOR >= 12
2311 +        return llvm::StructType::getTypeByName(M->getContext(), Name);
2312 +#else
2313 +        return M->getTypeByName(Name);
2314 +#endif
2315 +    }
2316 +
2317  }
2318  
2319  #endif
2320 diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
2321 index e8b5621a58..f5abae93c2 100644
2322 --- a/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
2323 +++ b/IGC/WrapperLLVM/include/llvmWrapper/Support/TypeSize.h
2324 @@ -33,10 +33,14 @@ using namespace llvm;
2325  namespace IGCLLVM {
2326  #if LLVM_VERSION_MAJOR < 11
2327  inline unsigned getElementCount(unsigned EC) { return EC; }
2328 -#else
2329 +#elif LLVM_VERSION_MAJOR == 11
2330  inline ElementCount getElementCount(unsigned EC) {
2331    return ElementCount(EC, false);
2332  }
2333 +#else
2334 +inline ElementCount getElementCount(unsigned EC) {
2335 +  return ElementCount::get(EC, false);
2336 +}
2337  #endif
2338  } // namespace IGCLLVM
2339  
2340 diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
2341 index df56f417bd..97c627347c 100644
2342 --- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
2343 +++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h
2344 @@ -42,7 +42,7 @@ namespace IGCLLVM
2345      {
2346          return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
2347      }
2348 -#elif LLVM_VERSION_MAJOR == 9 || LLVM_VERSION_MAJOR == 10 || LLVM_VERSION_MAJOR == 11
2349 +#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 12
2350      inline static llvm::Pass * createLoopUnrollPass(
2351          int OptLevel = 2, int Threshold = -1, int Count = -1,
2352          int AllowPartial = -1, int Runtime = -1,
2353 @@ -50,7 +50,7 @@ namespace IGCLLVM
2354      {
2355          return llvm::createLoopUnrollPass(OptLevel, false, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling);
2356      }
2357 -#elif LLVM_VERSION_MAJOR >= 12
2358 +#else
2359      //DO NOT assume same function signature for all incoming llvm versions! Double check to upgrade!
2360  #error Not supported llvm version.
2361  #endif
2362 diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
2363 index 6868b09fbe..78a55949aa 100644
2364 --- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
2365 +++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Utils/LoopUtils.h
2366 @@ -39,6 +39,14 @@ namespace IGCLLVM
2367          return llvm::InsertPreheaderForLoop(L, DT, LI, nullptr, PreserveLCSSA);
2368      }
2369  #endif
2370 +
2371 +    inline bool isInnermost(llvm::Loop *L) {
2372 +#if LLVM_VERSION_MAJOR >= 12
2373 +        return L->isInnermost();
2374 +#else
2375 +        return L->empty();
2376 +#endif
2377 +    }
2378  }
2379  
2380  #endif
2381 diff --git a/IGC/common/igc_resourceDimTypes.h b/IGC/common/igc_resourceDimTypes.h
2382 index 6831b06c8e..d790330fb8 100644
2383 --- a/IGC/common/igc_resourceDimTypes.h
2384 +++ b/IGC/common/igc_resourceDimTypes.h
2385 @@ -66,6 +66,11 @@ namespace IGC
2386              resourceDimTypeId == DIM_2D_TYPE || resourceDimTypeId == DIM_2D_ARRAY_TYPE ||
2387              resourceDimTypeId == DIM_3D_TYPE || resourceDimTypeId == DIM_CUBE_TYPE || resourceDimTypeId == DIM_CUBE_ARRAY_TYPE));
2388  
2389 +#if LLVM_VERSION_MAJOR >= 12
2390 +        llvm::LLVMContext& llvmCtx = module.getContext();
2391 +        return llvm::StructType::getTypeByName(llvmCtx, ResourceDimensionTypeName[resourceDimTypeId]);
2392 +#else
2393          return module.getTypeByName(ResourceDimensionTypeName[resourceDimTypeId]);
2394 +#endif
2395      }
2396  }
2397 \ No newline at end of file
This page took 0.299341 seconds and 3 git commands to generate.