[SVE] Remove calls to VectorType::isScalable from analysis
Reviewers: efriedma, sdesmalen, chandlerc, sunfish Reviewed By: efriedma Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77692
This commit is contained in:
parent
156afb2253
commit
9174e0229f
|
@ -533,8 +533,7 @@ bool BasicAAResult::DecomposeGEPExpression(const Value *V,
|
|||
|
||||
// Don't attempt to analyze GEPs if index scale is not a compile-time
|
||||
// constant.
|
||||
Type *SrcEleTy = GEPOp->getSourceElementType();
|
||||
if (SrcEleTy->isVectorTy() && cast<VectorType>(SrcEleTy)->isScalable()) {
|
||||
if (isa<ScalableVectorType>(GEPOp->getSourceElementType())) {
|
||||
Decomposed.Base = V;
|
||||
Decomposed.HasCompileTimeConstantScale = false;
|
||||
return false;
|
||||
|
|
|
@ -509,7 +509,7 @@ bool ReadDataFromGlobal(Constant *C, uint64_t ByteOffset, unsigned char *CurPtr,
|
|||
Constant *FoldReinterpretLoadFromConstPtr(Constant *C, Type *LoadTy,
|
||||
const DataLayout &DL) {
|
||||
// Bail out early. Not expect to load from scalable global variable.
|
||||
if (LoadTy->isVectorTy() && cast<VectorType>(LoadTy)->isScalable())
|
||||
if (isa<ScalableVectorType>(LoadTy))
|
||||
return nullptr;
|
||||
|
||||
auto *PTy = cast<PointerType>(C->getType());
|
||||
|
@ -836,8 +836,7 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP,
|
|||
Type *SrcElemTy = GEP->getSourceElementType();
|
||||
Type *ResElemTy = GEP->getResultElementType();
|
||||
Type *ResTy = GEP->getType();
|
||||
if (!SrcElemTy->isSized() ||
|
||||
(SrcElemTy->isVectorTy() && cast<VectorType>(SrcElemTy)->isScalable()))
|
||||
if (!SrcElemTy->isSized() || isa<ScalableVectorType>(SrcElemTy))
|
||||
return nullptr;
|
||||
|
||||
if (Constant *C = CastGEPIndices(SrcElemTy, Ops, ResTy,
|
||||
|
@ -2572,7 +2571,7 @@ static Constant *ConstantFoldVectorCall(StringRef Name,
|
|||
|
||||
// Do not iterate on scalable vector. The number of elements is unknown at
|
||||
// compile-time.
|
||||
if (VTy->isScalable())
|
||||
if (isa<ScalableVectorType>(VTy))
|
||||
return nullptr;
|
||||
|
||||
if (IntrinsicID == Intrinsic::masked_load) {
|
||||
|
|
|
@ -4151,8 +4151,7 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef<Value *> Ops,
|
|||
if (isa<UndefValue>(Ops[0]))
|
||||
return UndefValue::get(GEPTy);
|
||||
|
||||
bool IsScalableVec =
|
||||
isa<VectorType>(SrcTy) && cast<VectorType>(SrcTy)->isScalable();
|
||||
bool IsScalableVec = isa<ScalableVectorType>(SrcTy);
|
||||
|
||||
if (Ops.size() == 2) {
|
||||
// getelementptr P, 0 -> P.
|
||||
|
@ -4294,8 +4293,8 @@ Value *llvm::SimplifyInsertElementInst(Value *Vec, Value *Val, Value *Idx,
|
|||
|
||||
// For fixed-length vector, fold into undef if index is out of bounds.
|
||||
if (auto *CI = dyn_cast<ConstantInt>(Idx)) {
|
||||
if (!cast<VectorType>(Vec->getType())->isScalable() &&
|
||||
CI->uge(cast<VectorType>(Vec->getType())->getNumElements()))
|
||||
if (isa<FixedVectorType>(Vec->getType()) &&
|
||||
CI->uge(cast<FixedVectorType>(Vec->getType())->getNumElements()))
|
||||
return UndefValue::get(Vec->getType());
|
||||
}
|
||||
|
||||
|
@ -4368,7 +4367,8 @@ static Value *SimplifyExtractElementInst(Value *Vec, Value *Idx, const SimplifyQ
|
|||
// find a previously computed scalar that was inserted into the vector.
|
||||
if (auto *IdxC = dyn_cast<ConstantInt>(Idx)) {
|
||||
// For fixed-length vector, fold into undef if index is out of bounds.
|
||||
if (!VecVTy->isScalable() && IdxC->getValue().uge(VecVTy->getNumElements()))
|
||||
if (isa<FixedVectorType>(VecVTy) &&
|
||||
IdxC->getValue().uge(VecVTy->getNumElements()))
|
||||
return UndefValue::get(VecVTy->getElementType());
|
||||
if (Value *Elt = findScalarElement(Vec, IdxC->getZExtValue()))
|
||||
return Elt;
|
||||
|
|
|
@ -148,8 +148,7 @@ bool llvm::isDereferenceableAndAlignedPointer(const Value *V, Type *Ty,
|
|||
const DominatorTree *DT) {
|
||||
// For unsized types or scalable vectors we don't know exactly how many bytes
|
||||
// are dereferenced, so bail out.
|
||||
if (!Ty->isSized() ||
|
||||
(Ty->isVectorTy() && cast<VectorType>(Ty)->isScalable()))
|
||||
if (!Ty->isSized() || isa<ScalableVectorType>(Ty))
|
||||
return false;
|
||||
|
||||
// When dereferenceability information is provided by a dereferenceable
|
||||
|
|
|
@ -650,8 +650,7 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitAllocaInst(AllocaInst &I) {
|
|||
if (!I.getAllocatedType()->isSized())
|
||||
return unknown();
|
||||
|
||||
if (I.getAllocatedType()->isVectorTy() &&
|
||||
cast<VectorType>(I.getAllocatedType())->isScalable())
|
||||
if (isa<ScalableVectorType>(I.getAllocatedType()))
|
||||
return unknown();
|
||||
|
||||
APInt Size(IntTyBits, DL.getTypeAllocSize(I.getAllocatedType()));
|
||||
|
|
|
@ -3759,13 +3759,11 @@ const SCEV *ScalarEvolution::getSizeOfExpr(Type *IntTy, Type *AllocTy) {
|
|||
// We can bypass creating a target-independent
|
||||
// constant expression and then folding it back into a ConstantInt.
|
||||
// This is just a compile-time optimization.
|
||||
if (auto *VecTy = dyn_cast<VectorType>(AllocTy)) {
|
||||
if (VecTy->isScalable()) {
|
||||
Constant *NullPtr = Constant::getNullValue(AllocTy->getPointerTo());
|
||||
Constant *One = ConstantInt::get(IntTy, 1);
|
||||
Constant *GEP = ConstantExpr::getGetElementPtr(AllocTy, NullPtr, One);
|
||||
return getSCEV(ConstantExpr::getPtrToInt(GEP, IntTy));
|
||||
}
|
||||
if (isa<ScalableVectorType>(AllocTy)) {
|
||||
Constant *NullPtr = Constant::getNullValue(AllocTy->getPointerTo());
|
||||
Constant *One = ConstantInt::get(IntTy, 1);
|
||||
Constant *GEP = ConstantExpr::getGetElementPtr(AllocTy, NullPtr, One);
|
||||
return getSCEV(ConstantExpr::getPtrToInt(GEP, IntTy));
|
||||
}
|
||||
return getConstant(IntTy, getDataLayout().getTypeAllocSize(AllocTy));
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ static bool getShuffleDemandedElts(const ShuffleVectorInst *Shuf,
|
|||
APInt &DemandedLHS, APInt &DemandedRHS) {
|
||||
// The length of scalable vectors is unknown at compile time, thus we
|
||||
// cannot check their values
|
||||
if (Shuf->getType()->isScalable())
|
||||
if (isa<ScalableVectorType>(Shuf->getType()))
|
||||
return false;
|
||||
|
||||
int NumElts =
|
||||
|
|
|
@ -263,10 +263,10 @@ Value *llvm::findScalarElement(Value *V, unsigned EltNo) {
|
|||
assert(V->getType()->isVectorTy() && "Not looking at a vector?");
|
||||
VectorType *VTy = cast<VectorType>(V->getType());
|
||||
// For fixed-length vector, return undef for out of range access.
|
||||
if (!VTy->isScalable()) {
|
||||
unsigned Width = VTy->getNumElements();
|
||||
if (auto *FVTy = dyn_cast<FixedVectorType>(VTy)) {
|
||||
unsigned Width = FVTy->getNumElements();
|
||||
if (EltNo >= Width)
|
||||
return UndefValue::get(VTy->getElementType());
|
||||
return UndefValue::get(FVTy->getElementType());
|
||||
}
|
||||
|
||||
if (Constant *C = dyn_cast<Constant>(V))
|
||||
|
|
Loading…
Reference in New Issue