Skip to content

Commit 466c703

Browse files
pszymichsys_zuul
authored andcommitted
Various changes for LLVM 11.
Change-Id: I1d758041a1f6cb440cda7a91de9afe9a48f46fe6
1 parent 4de66f6 commit 466c703

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

IGC/Compiler/CISACodeGen/CShader.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1809,9 +1809,11 @@ VISA_Type CShader::GetType(llvm::Type* type)
18091809
uint32_t CShader::GetNumElts(llvm::Type* type, bool isUniform)
18101810
{
18111811
uint32_t numElts = isUniform ? 1 : numLanes(m_SIMDSize);
1812+
18121813
if (type->isVectorTy())
18131814
{
1814-
IGC_ASSERT(type->getVectorElementType()->isIntegerTy() || type->getVectorElementType()->isFloatingPointTy());
1815+
IGC_ASSERT(type->getContainedType(0)->isIntegerTy() || type->getContainedType(0)->isFloatingPointTy());
1816+
18151817
auto VT = cast<VectorType>(type);
18161818
numElts *= (uint16_t)VT->getNumElements();
18171819
}

IGC/Compiler/CISACodeGen/VectorPreProcess.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4444

4545
using namespace llvm;
4646
using namespace IGC;
47+
using IGCLLVM::FixedVectorType;
4748

4849
//
4950
// Description of VectorPreProcess Pass
@@ -562,7 +563,7 @@ void VectorPreProcess::createSplitVectorTypes(
562563
uint32_t M = N / E; // the number of subvectors for split size E
563564
if (M > 0)
564565
{
565-
Type* Ty = (E == 1) ? ETy : VectorType::get(ETy, E);
566+
Type* Ty = (E == 1) ? ETy : FixedVectorType::get(ETy, E);
566567
SplitInfo.push_back(std::make_pair(Ty, M));
567568
}
568569
N = N % E;
@@ -576,7 +577,7 @@ void VectorPreProcess::createSplitVectorTypes(
576577
M = N / E; // the number of subvectors for split size E
577578
if (M > 0)
578579
{
579-
SplitInfo.push_back(std::make_pair(VectorType::get(ETy, E), M));
580+
SplitInfo.push_back(std::make_pair(FixedVectorType::get(ETy, E), M));
580581
}
581582
// The remaining elts are to be split for next iteration.
582583
N = N % E;
@@ -586,7 +587,7 @@ void VectorPreProcess::createSplitVectorTypes(
586587
// 3. A vector of 1|2|3|4 elements. No further splitting!
587588
if (N > 0)
588589
{
589-
Type* Ty = (N == 1) ? ETy : VectorType::get(ETy, N);
590+
Type* Ty = (N == 1) ? ETy : FixedVectorType::get(ETy, N);
590591
SplitInfo.push_back(std::make_pair(Ty, 1));
591592
}
592593
}
@@ -682,7 +683,7 @@ bool VectorPreProcess::splitStore(
682683
std::vector<Value*> splitScalars;
683684
IGC_ASSERT(Ty1->getScalarSizeInBits());
684685
const uint32_t vectorSize = (unsigned int)ETy->getPrimitiveSizeInBits() / Ty1->getScalarSizeInBits();
685-
Type* splitType = llvm::VectorType::get(Ty1, vectorSize);
686+
Type* splitType = FixedVectorType::get(Ty1, vectorSize);
686687
for (uint32_t i = 0; i < nelts; i++)
687688
{
688689
Value* splitInst = aBuilder.CreateBitCast(scalars[i], splitType);
@@ -883,7 +884,7 @@ bool VectorPreProcess::splitLoad(
883884
{
884885
builder.SetInsertPoint(nextInst);
885886
}
886-
Value* undef = UndefValue::get(VectorType::get(svals[0]->getType(), scalarsPerElement));
887+
Value* undef = UndefValue::get(FixedVectorType::get(svals[0]->getType(), scalarsPerElement));
887888
for (uint32_t i = 0; i < svals.size() / scalarsPerElement; i++)
888889
{
889890
Value* newElement = undef;
@@ -1000,7 +1001,7 @@ bool VectorPreProcess::splitVector3LoadStore(Instruction* Inst)
10001001
if (ALI->getAlignment() >= 4 * etyBytes)
10011002
{
10021003
// Make it 4-element load
1003-
Type* newVTy = VectorType::get(eTy, 4);
1004+
Type* newVTy = FixedVectorType::get(eTy, 4);
10041005
Value* V = ALI->Create(newVTy);
10051006

10061007
Elt0 = Builder.CreateExtractElement(V, Builder.getInt32(0), "elt0");
@@ -1010,7 +1011,7 @@ bool VectorPreProcess::splitVector3LoadStore(Instruction* Inst)
10101011
else
10111012
{
10121013
// One 2-element vector load + one scalar load
1013-
Type* newVTy = VectorType::get(eTy, 2);
1014+
Type* newVTy = FixedVectorType::get(eTy, 2);
10141015
Value* offsetAddr = ALI->CreateConstScalarGEP(eTy, ALI->getPointerOperand(), 2);
10151016
Value* V2 = ALI->Create(newVTy);
10161017
Elt0 = Builder.CreateExtractElement(V2, Builder.getInt32(0), "elt0");
@@ -1058,7 +1059,7 @@ bool VectorPreProcess::splitVector3LoadStore(Instruction* Inst)
10581059
{
10591060
Value* Ptr = ASI->getPointerOperand();
10601061
// Split 3-element into 2-element + 1 scalar
1061-
Type* newVTy = VectorType::get(eTy, 2);
1062+
Type* newVTy = FixedVectorType::get(eTy, 2);
10621063
Value* StoredVal = ASI->getValueOperand();
10631064
Value* offsetAddr = ASI->CreateConstScalarGEP(StoredVal->getType(), Ptr, 2);
10641065
InsertElementInst* IEInsts[3];
@@ -1301,7 +1302,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
13011302
if (N == MaxIndex + 1)
13021303
return Inst;
13031304

1304-
Type* NewVecTy = IGCLLVM::FixedVectorType::get(cast<VectorType>(Inst->getType())->getElementType(),
1305+
Type* NewVecTy = FixedVectorType::get(cast<VectorType>(Inst->getType())->getElementType(),
13051306
MaxIndex + 1);
13061307
IRBuilder<> Builder(Inst);
13071308
Instruction* NewLI = ALI.Create(NewVecTy);
@@ -1413,7 +1414,7 @@ Instruction* VectorPreProcess::simplifyLoadStore(Instruction* Inst)
14131414
if (MaxIndex >= 0 && MaxIndex + 1 < (int)N && isa<UndefValue>(ChainVal))
14141415
{
14151416
IRBuilder<> Builder(ASI.getInst());
1416-
Type* NewVecTy = VectorType::get(cast<VectorType>(Val->getType())->getElementType(),
1417+
Type* NewVecTy = FixedVectorType::get(cast<VectorType>(Val->getType())->getElementType(),
14171418
MaxIndex + 1);
14181419
Value* SVal = UndefValue::get(NewVecTy);
14191420
for (int i = 0; i <= MaxIndex; ++i)

IGC/Compiler/CISACodeGen/VectorProcess.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3131
#include "common/IGCIRBuilder.h"
3232
#include "common/LLVMWarningsPush.hpp"
3333
#include "llvmWrapper/Support/Alignment.h"
34+
#include "llvmWrapper/IR/DerivedTypes.h"
3435
#include <llvm/IR/DataLayout.h>
3536
#include <llvm/IR/Instructions.h>
3637
#include <llvm/IR/IRBuilder.h>
@@ -41,6 +42,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4142

4243
using namespace llvm;
4344
using namespace IGC;
45+
using IGCLLVM::FixedVectorType;
4446

4547
//
4648
// Description of VectorProcess Pass
@@ -334,7 +336,7 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst)
334336
}
335337
else
336338
{
337-
newVTy = VectorType::get(new_eTy, new_nelts);
339+
newVTy = FixedVectorType::get(new_eTy, new_nelts);
338340
}
339341
Type* newPtrTy = PointerType::get(newVTy, PtrTy->getPointerAddressSpace());
340342
Value* newPtr;
@@ -365,7 +367,7 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst)
365367
// with int-element type.
366368
// second, IntToPtr cast to the original vector type.
367369
Type* int_eTy = Type::getIntNTy(*m_C, eTyBits);
368-
Type* new_intTy = VTy ? VectorType::get(int_eTy, nelts) : int_eTy;
370+
Type* new_intTy = VTy ? FixedVectorType::get(int_eTy, nelts) : int_eTy;
369371
V = Builder.CreateBitCast(V, new_intTy);
370372
if (VTy)
371373
{
@@ -405,7 +407,7 @@ bool VectorProcess::reLayoutLoadStore(Instruction* Inst)
405407
if (VTy)
406408
{
407409
// If we need a vector inttoptr, scalarize it here.
408-
V = UndefValue::get(VectorType::get(int_eTy, nelts));
410+
V = UndefValue::get(FixedVectorType::get(int_eTy, nelts));
409411
for (unsigned i = 0; i < nelts; i++)
410412
{
411413
auto* EE = Builder.CreateExtractElement(StoreVal, i);

IGC/Compiler/GenTTI.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ namespace llvm
6868

6969
#if LLVM_VERSION_MAJOR >= 11
7070
void getPeelingPreferences(Loop* L, ScalarEvolution& SE,
71-
llvm::TargetTransformInfo::PeelingPreferences& PP);
71+
TTI::PeelingPreferences& PP);
7272
#endif
7373

7474
bool isProfitableToHoist(Instruction* I);
@@ -87,4 +87,4 @@ namespace llvm
8787

8888
};
8989

90-
}
90+
}

0 commit comments

Comments
 (0)