forked from OSchip/llvm-project
[Alignment][NFC] Migrate TTI::isLegalToVectorize{Load,Store}Chain to Align
This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Differential Revision: https://reviews.llvm.org/D82653
This commit is contained in:
parent
431daedee4
commit
1507fc1506
|
@ -1181,13 +1181,11 @@ public:
|
||||||
bool isLegalToVectorizeStore(StoreInst *SI) const;
|
bool isLegalToVectorizeStore(StoreInst *SI) const;
|
||||||
|
|
||||||
/// \returns True if it is legal to vectorize the given load chain.
|
/// \returns True if it is legal to vectorize the given load chain.
|
||||||
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const;
|
unsigned AddrSpace) const;
|
||||||
|
|
||||||
/// \returns True if it is legal to vectorize the given store chain.
|
/// \returns True if it is legal to vectorize the given store chain.
|
||||||
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const;
|
unsigned AddrSpace) const;
|
||||||
|
|
||||||
/// \returns The new vector factor value if the target doesn't support \p
|
/// \returns The new vector factor value if the target doesn't support \p
|
||||||
|
@ -1478,10 +1476,10 @@ public:
|
||||||
virtual bool isLegalToVectorizeLoad(LoadInst *LI) const = 0;
|
virtual bool isLegalToVectorizeLoad(LoadInst *LI) const = 0;
|
||||||
virtual bool isLegalToVectorizeStore(StoreInst *SI) const = 0;
|
virtual bool isLegalToVectorizeStore(StoreInst *SI) const = 0;
|
||||||
virtual bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
virtual bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
||||||
unsigned Alignment,
|
Align Alignment,
|
||||||
unsigned AddrSpace) const = 0;
|
unsigned AddrSpace) const = 0;
|
||||||
virtual bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
virtual bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
||||||
unsigned Alignment,
|
Align Alignment,
|
||||||
unsigned AddrSpace) const = 0;
|
unsigned AddrSpace) const = 0;
|
||||||
virtual unsigned getLoadVectorFactor(unsigned VF, unsigned LoadSize,
|
virtual unsigned getLoadVectorFactor(unsigned VF, unsigned LoadSize,
|
||||||
unsigned ChainSizeInBytes,
|
unsigned ChainSizeInBytes,
|
||||||
|
@ -1943,14 +1941,12 @@ public:
|
||||||
bool isLegalToVectorizeStore(StoreInst *SI) const override {
|
bool isLegalToVectorizeStore(StoreInst *SI) const override {
|
||||||
return Impl.isLegalToVectorizeStore(SI);
|
return Impl.isLegalToVectorizeStore(SI);
|
||||||
}
|
}
|
||||||
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const override {
|
unsigned AddrSpace) const override {
|
||||||
return Impl.isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment,
|
return Impl.isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment,
|
||||||
AddrSpace);
|
AddrSpace);
|
||||||
}
|
}
|
||||||
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const override {
|
unsigned AddrSpace) const override {
|
||||||
return Impl.isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment,
|
return Impl.isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment,
|
||||||
AddrSpace);
|
AddrSpace);
|
||||||
|
|
|
@ -607,14 +607,12 @@ public:
|
||||||
|
|
||||||
bool isLegalToVectorizeStore(StoreInst *SI) const { return true; }
|
bool isLegalToVectorizeStore(StoreInst *SI) const { return true; }
|
||||||
|
|
||||||
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -910,13 +910,13 @@ bool TargetTransformInfo::isLegalToVectorizeStore(StoreInst *SI) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TargetTransformInfo::isLegalToVectorizeLoadChain(
|
bool TargetTransformInfo::isLegalToVectorizeLoadChain(
|
||||||
unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const {
|
unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const {
|
||||||
return TTIImpl->isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment,
|
return TTIImpl->isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment,
|
||||||
AddrSpace);
|
AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TargetTransformInfo::isLegalToVectorizeStoreChain(
|
bool TargetTransformInfo::isLegalToVectorizeStoreChain(
|
||||||
unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const {
|
unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const {
|
||||||
return TTIImpl->isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment,
|
return TTIImpl->isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment,
|
||||||
AddrSpace);
|
AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,8 +293,8 @@ unsigned GCNTTIImpl::getLoadStoreVecRegBitWidth(unsigned AddrSpace) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GCNTTIImpl::isLegalToVectorizeMemChain(unsigned ChainSizeInBytes,
|
bool GCNTTIImpl::isLegalToVectorizeMemChain(unsigned ChainSizeInBytes,
|
||||||
unsigned Alignment,
|
Align Alignment,
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
// We allow vectorization of flat stores, even though we may need to decompose
|
// We allow vectorization of flat stores, even though we may need to decompose
|
||||||
// them later if they may access private memory. We don't have enough context
|
// them later if they may access private memory. We don't have enough context
|
||||||
// here, and legalization can handle it.
|
// here, and legalization can handle it.
|
||||||
|
@ -306,14 +306,14 @@ bool GCNTTIImpl::isLegalToVectorizeMemChain(unsigned ChainSizeInBytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GCNTTIImpl::isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
bool GCNTTIImpl::isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
||||||
unsigned Alignment,
|
Align Alignment,
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
return isLegalToVectorizeMemChain(ChainSizeInBytes, Alignment, AddrSpace);
|
return isLegalToVectorizeMemChain(ChainSizeInBytes, Alignment, AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GCNTTIImpl::isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
bool GCNTTIImpl::isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
||||||
unsigned Alignment,
|
Align Alignment,
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
return isLegalToVectorizeMemChain(ChainSizeInBytes, Alignment, AddrSpace);
|
return isLegalToVectorizeMemChain(ChainSizeInBytes, Alignment, AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1025,7 +1025,7 @@ unsigned R600TTIImpl::getLoadStoreVecRegBitWidth(unsigned AddrSpace) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool R600TTIImpl::isLegalToVectorizeMemChain(unsigned ChainSizeInBytes,
|
bool R600TTIImpl::isLegalToVectorizeMemChain(unsigned ChainSizeInBytes,
|
||||||
unsigned Alignment,
|
Align Alignment,
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
// We allow vectorization of flat stores, even though we may need to decompose
|
// We allow vectorization of flat stores, even though we may need to decompose
|
||||||
// them later if they may access private memory. We don't have enough context
|
// them later if they may access private memory. We don't have enough context
|
||||||
|
@ -1034,13 +1034,13 @@ bool R600TTIImpl::isLegalToVectorizeMemChain(unsigned ChainSizeInBytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool R600TTIImpl::isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
bool R600TTIImpl::isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
||||||
unsigned Alignment,
|
Align Alignment,
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
return isLegalToVectorizeMemChain(ChainSizeInBytes, Alignment, AddrSpace);
|
return isLegalToVectorizeMemChain(ChainSizeInBytes, Alignment, AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool R600TTIImpl::isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
bool R600TTIImpl::isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
||||||
unsigned Alignment,
|
Align Alignment,
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
return isLegalToVectorizeMemChain(ChainSizeInBytes, Alignment, AddrSpace);
|
return isLegalToVectorizeMemChain(ChainSizeInBytes, Alignment, AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,14 +158,11 @@ public:
|
||||||
VectorType *VecTy) const;
|
VectorType *VecTy) const;
|
||||||
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const;
|
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const;
|
||||||
|
|
||||||
bool isLegalToVectorizeMemChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeMemChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const;
|
unsigned AddrSpace) const;
|
||||||
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const;
|
unsigned AddrSpace) const;
|
||||||
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const;
|
unsigned AddrSpace) const;
|
||||||
Type *getMemcpyLoopLoweringType(LLVMContext &Context, Value *Length,
|
Type *getMemcpyLoopLoweringType(LLVMContext &Context, Value *Length,
|
||||||
unsigned SrcAddrSpace, unsigned DestAddrSpace,
|
unsigned SrcAddrSpace, unsigned DestAddrSpace,
|
||||||
|
@ -266,13 +263,11 @@ public:
|
||||||
unsigned getRegisterBitWidth(bool Vector) const;
|
unsigned getRegisterBitWidth(bool Vector) const;
|
||||||
unsigned getMinVectorRegisterBitWidth() const;
|
unsigned getMinVectorRegisterBitWidth() const;
|
||||||
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const;
|
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const;
|
||||||
bool isLegalToVectorizeMemChain(unsigned ChainSizeInBytes, unsigned Alignment,
|
bool isLegalToVectorizeMemChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned AddrSpace) const;
|
unsigned AddrSpace) const;
|
||||||
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const;
|
unsigned AddrSpace) const;
|
||||||
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const;
|
unsigned AddrSpace) const;
|
||||||
unsigned getMaxInterleaveFactor(unsigned VF);
|
unsigned getMaxInterleaveFactor(unsigned VF);
|
||||||
unsigned getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind);
|
unsigned getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind);
|
||||||
|
|
|
@ -50,13 +50,11 @@ public:
|
||||||
|
|
||||||
// Loads and stores can be vectorized if the alignment is at least as big as
|
// Loads and stores can be vectorized if the alignment is at least as big as
|
||||||
// the load/store we want to vectorize.
|
// the load/store we want to vectorize.
|
||||||
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
return Alignment >= ChainSizeInBytes;
|
return Alignment >= ChainSizeInBytes;
|
||||||
}
|
}
|
||||||
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
|
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment,
|
||||||
unsigned Alignment,
|
|
||||||
unsigned AddrSpace) const {
|
unsigned AddrSpace) const {
|
||||||
return isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment, AddrSpace);
|
return isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment, AddrSpace);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1073,7 +1073,7 @@ bool Vectorizer::vectorizeStoreChain(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TTI.isLegalToVectorizeStoreChain(SzInBytes, Alignment.value(), AS)) {
|
if (!TTI.isLegalToVectorizeStoreChain(SzInBytes, Alignment, AS)) {
|
||||||
auto Chains = splitOddVectorElts(Chain, Sz);
|
auto Chains = splitOddVectorElts(Chain, Sz);
|
||||||
return vectorizeStoreChain(Chains.first, InstructionsProcessed) |
|
return vectorizeStoreChain(Chains.first, InstructionsProcessed) |
|
||||||
vectorizeStoreChain(Chains.second, InstructionsProcessed);
|
vectorizeStoreChain(Chains.second, InstructionsProcessed);
|
||||||
|
@ -1218,7 +1218,7 @@ bool Vectorizer::vectorizeLoadChain(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TTI.isLegalToVectorizeLoadChain(SzInBytes, Alignment.value(), AS)) {
|
if (!TTI.isLegalToVectorizeLoadChain(SzInBytes, Alignment, AS)) {
|
||||||
auto Chains = splitOddVectorElts(Chain, Sz);
|
auto Chains = splitOddVectorElts(Chain, Sz);
|
||||||
return vectorizeLoadChain(Chains.first, InstructionsProcessed) |
|
return vectorizeLoadChain(Chains.first, InstructionsProcessed) |
|
||||||
vectorizeLoadChain(Chains.second, InstructionsProcessed);
|
vectorizeLoadChain(Chains.second, InstructionsProcessed);
|
||||||
|
|
Loading…
Reference in New Issue