// Do not perform canonicalization if minmax pattern is found (to avoid
// infinite loop).
Type *Dummy;
- if (!Ty->isIntegerTy() && Ty->isSized() &&
- !(Ty->isVectorTy() && cast<VectorType>(Ty)->isScalable()) &&
+ if (!Ty->isIntegerTy() && Ty->isSized() && !isa<ScalableVectorType>(Ty) &&
DL.isLegalInteger(DL.getTypeStoreSizeInBits(Ty)) &&
DL.typeSizeEqualsStoreSize(Ty) && !DL.isNonIntegralPointerType(Ty) &&
!isMinMaxWithLoads(
SmallVector<Value*, 8> Ops(GEP.op_begin(), GEP.op_end());
Type *GEPType = GEP.getType();
Type *GEPEltType = GEP.getSourceElementType();
- bool IsGEPSrcEleScalable =
- GEPEltType->isVectorTy() && cast<VectorType>(GEPEltType)->isScalable();
+ bool IsGEPSrcEleScalable = isa<ScalableVectorType>(GEPEltType);
if (Value *V = SimplifyGEPInst(GEPEltType, Ops, SQ.getWithInstruction(&GEP)))
return replaceInstUsesWith(GEP, V);
// For vector geps, use the generic demanded vector support.
// Skip if GEP return type is scalable. The number of elements is unknown at
// compile-time.
- if (GEPType->isVectorTy() && !cast<VectorType>(GEPType)->isScalable()) {
- auto VWidth = cast<VectorType>(GEPType)->getNumElements();
+ if (auto *GEPFVTy = dyn_cast<FixedVectorType>(GEPType)) {
+ auto VWidth = GEPFVTy->getNumElements();
APInt UndefElts(VWidth, 0);
APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));
if (Value *V = SimplifyDemandedVectorElts(&GEP, AllOnesEltMask,
break;
case Instruction::ExtractElement: {
Value *Vec = I.getOperand(0);
- auto *VecVTy = cast<VectorType>(Vec->getType());
- if (VecVTy->isScalable())
+ auto *VecVTy = dyn_cast<FixedVectorType>(Vec->getType());
+ if (!VecVTy)
break;
Value *Idx = I.getOperand(1);
unsigned NumElts = VecVTy->getNumElements();
}
case Instruction::InsertElement: {
Value *Vec = I.getOperand(0);
- auto *VecVTy = cast<VectorType>(Vec->getType());
- if (VecVTy->isScalable())
+ auto *VecVTy = dyn_cast<FixedVectorType>(Vec->getType());
+ if (!VecVTy)
break;
Value *Idx = I.getOperand(2);
unsigned NumElts = VecVTy->getNumElements();
// Skip alloca forms that this analysis can't handle.
auto *AT = AI.getAllocatedType();
- if (AI.isArrayAllocation() || !AT->isSized() ||
- (isa<VectorType>(AT) && cast<VectorType>(AT)->isScalable()) ||
+ if (AI.isArrayAllocation() || !AT->isSized() || isa<ScalableVectorType>(AT) ||
DL.getTypeAllocSize(AT).getFixedSize() == 0)
return false;
for (BasicBlock::iterator I = EntryBB.begin(), E = std::prev(EntryBB.end());
I != E; ++I) {
if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) {
- if (isa<VectorType>(AI->getAllocatedType()) &&
- cast<VectorType>(AI->getAllocatedType())->isScalable()) {
+ if (isa<ScalableVectorType>(AI->getAllocatedType())) {
if (isAllocaPromotable(AI))
PromotableAllocas.push_back(AI);
} else {
namespace VNCoercion {
static bool isFirstClassAggregateOrScalableType(Type *Ty) {
- return Ty->isStructTy() || Ty->isArrayTy() ||
- (Ty->isVectorTy() && cast<VectorType>(Ty)->isScalable());
+ return Ty->isStructTy() || Ty->isArrayTy() || isa<ScalableVectorType>(Ty);
}
/// Return true if coerceAvailableValueToLoadType will succeed.