Skip to content

Commit a9c10d0

Browse files
Sidorenko, Antonsys_zuul
authored andcommitted
Fix VC building for LLVM11
Part 4 Some unique fixes 1. Added TTI::TargetCostKind to getUserCost 2. Fixed invalid-use-of-incomplete-type-class-llvm-CallInst 3. Added work around for ShuffleVector getMask() 4. getSequentialElementType was changed to VectorType related code (logically it's OK) 5. getRoots.front() was changed to getRoot 6. Added more accurate work with iterators 7. Removed PassSupport.h from include list Change-Id: If85a7c8b87e736d1a12bcafb2357a29c38659397
1 parent af1daf2 commit a9c10d0

File tree

8 files changed

+32
-14
lines changed

8 files changed

+32
-14
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/FunctionGroup.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,17 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3535
//===----------------------------------------------------------------------===//
3636

3737
#include "FunctionGroup.h"
38+
#include "llvm/GenXIntrinsics/GenXMetadata.h"
3839
#include "llvm/IR/Dominators.h"
3940
#include "llvm/IR/Function.h"
41+
#include "llvm/IR/Instructions.h"
4042
#include "llvm/IR/LLVMContext.h"
4143
#include "llvm/IR/Module.h"
4244
#include "llvm/Support/Debug.h"
4345
#include "llvm/Support/Timer.h"
4446
#include "llvm/Support/raw_ostream.h"
4547
#include "llvm/Transforms/Utils/Cloning.h"
4648
#include "llvm/Transforms/Utils/ValueMapper.h"
47-
#include "llvm/GenXIntrinsics/GenXMetadata.h"
4849
using namespace llvm;
4950

5051
#include "llvmWrapper/IR/LegacyPassManagers.h"

IGC/VectorCompiler/lib/GenXCodeGen/GenXCategory.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
160160
#include "llvm/IR/Instructions.h"
161161
#include "llvm/IR/Intrinsics.h"
162162
#include "llvm/IR/Metadata.h"
163-
#include "llvm/PassAnalysisSupport.h"
164163
#include "llvm/Support/Debug.h"
165164
#include "Probe/Assertion.h"
166165

IGC/VectorCompiler/lib/GenXCodeGen/GenXPatternMatch.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,9 +1372,9 @@ bool MinMaxMatcher::valuesMatch(llvm::Value *Op1, llvm::Value *Op2) {
13721372
return false;
13731373
Type *C1Ty = C1->getType();
13741374
Type *C2Ty = C2->getType();
1375-
if (C1Ty->isVectorTy()) {
1376-
C1Ty = C1Ty->getSequentialElementType();
1377-
C2Ty = C2Ty->getSequentialElementType();
1375+
if (auto C1VTy = dyn_cast<VectorType>(C1Ty)) {
1376+
C1Ty = C1VTy->getElementType();
1377+
C2Ty = cast<VectorType>(C2Ty)->getElementType();
13781378
}
13791379

13801380
return (C1Ty->isIntegerTy() && C2Ty->isIntegerTy()) ||

IGC/VectorCompiler/lib/GenXCodeGen/GenXReduceIntSize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,8 @@ GenXReduceIntSize::ValueNumBits GenXReduceIntSize::getValueNumBits(
10221022
}
10231023

10241024
Value *GenXReduceIntSize::getSplatValue(ShuffleVectorInst *SVI) const {
1025-
if (!SVI->getMask()->isNullValue())
1025+
auto ShuffleMask = SVI->getShuffleMask();
1026+
if (std::any_of(ShuffleMask.begin(), ShuffleMask.end(), [](int V) { return V != 0; }))
10261027
return nullptr;
10271028

10281029
Value *Src = SVI->getOperand(0);

IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ class GenXTTIImpl : public TargetTransformInfoImplCRTPBase<GenXTTIImpl>
114114
bool shouldBuildLookupTables() { return false; }
115115
unsigned getFlatAddressSpace() { return 4; }
116116

117-
int getUserCost(const User *U, ArrayRef<const Value *> Operands) {
117+
int getUserCost(const User *U, ArrayRef<const Value *> Operands
118+
#if LLVM_VERSION_MAJOR >= 11
119+
,
120+
TTI::TargetCostKind CostKind
121+
#endif
122+
) {
118123
if (auto EV = dyn_cast<ExtractValueInst>(U)) {
119124
switch(GenXIntrinsic::getGenXIntrinsicID(EV->getOperand(0))) {
120125
case GenXIntrinsic::genx_simdcf_goto:
@@ -126,7 +131,12 @@ class GenXTTIImpl : public TargetTransformInfoImplCRTPBase<GenXTTIImpl>
126131
}
127132
}
128133

129-
return BaseT::getUserCost(U, Operands);
134+
return BaseT::getUserCost(U, Operands
135+
#if LLVM_VERSION_MAJOR >= 11
136+
,
137+
CostKind
138+
#endif
139+
);
130140
}
131141

132142
bool isProfitableToHoist(Instruction *I) const {

IGC/VectorCompiler/lib/GenXCodeGen/GenXUtil.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4747
#include "llvm/IR/Module.h"
4848
#include "llvmWrapper/IR/Instructions.h"
4949

50-
#include <iterator>
5150
#include "Probe/Assertion.h"
51+
#include <iterator>
5252

5353
using namespace llvm;
5454
using namespace genx;
@@ -591,10 +591,15 @@ ShuffleVectorAnalyzer::getMaskRegionPrefix(int StartIdx) {
591591
if (StartIdx == MaskVals.size() - 1)
592592
return Res;
593593

594-
makeSVIIndexesOperandIndexes(*SI, *Res.Op, StartIt, MaskVals.end(), StartIt);
594+
std::vector<int>
595+
SubMask;
596+
makeSVIIndexesOperandIndexes(*SI, *Res.Op, StartIt, MaskVals.end(),
597+
std::back_inserter(SubMask));
595598

596-
Res.R = matchVectorRegionByIndexes(std::move(Res.R), StartIt, MaskVals.end());
597-
Res.R = matchMatrixRegionByIndexes(std::move(Res.R), StartIt, MaskVals.end());
599+
Res.R = matchVectorRegionByIndexes(std::move(Res.R), SubMask.begin(),
600+
SubMask.end());
601+
Res.R = matchMatrixRegionByIndexes(std::move(Res.R), SubMask.begin(),
602+
SubMask.end());
598603
return Res;
599604
}
600605

IGC/VectorCompiler/lib/GenXCodeGen/GenXVectorDecomposer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ int DiagnosticVectorDecomposition::KindID = 0;
120120
bool VectorDecomposer::run(DominatorTree *ArgDT)
121121
{
122122
DT = ArgDT;
123-
DL = &DT->getRoots().front()->getModule()->getDataLayout();
123+
DL = &DT->
124+
getRoot()
125+
->getModule()
126+
->getDataLayout();
124127
bool Modified = false;
125128
// Process each start wrregion added with addStartWrRegion().
126129
for (auto swi = StartWrRegions.begin(), swe = StartWrRegions.end();

IGC/VectorCompiler/lib/GenXOpts/CMAnalysis/InstructionSimplifyGenX.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4747
#include <llvm/IR/Instructions.h>
4848
#include <llvm/InitializePasses.h>
4949
#include <llvm/Pass.h>
50-
#include <llvm/PassSupport.h>
5150
#include <llvm/Support/Debug.h>
5251
#include <llvm/Support/CommandLine.h>
5352
#include "Probe/Assertion.h"

0 commit comments

Comments
 (0)