Skip to content

Commit 1e3bc92

Browse files
committed
[ValueTracking] Support scalable vectors for ExtractElemenet in computeKnownFPClass.
We can support scalable vectors by setting the demanded mask to APInt(1, 1) to demand the whole vector.
1 parent cd58586 commit 1e3bc92

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5604,19 +5604,19 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
56045604
// Look through extract element. If the index is non-constant or
56055605
// out-of-range demand all elements, otherwise just the extracted element.
56065606
const Value *Vec = Op->getOperand(0);
5607-
const Value *Idx = Op->getOperand(1);
5608-
auto *CIdx = dyn_cast<ConstantInt>(Idx);
56095607

5608+
APInt DemandedVecElts;
56105609
if (auto *VecTy = dyn_cast<FixedVectorType>(Vec->getType())) {
56115610
unsigned NumElts = VecTy->getNumElements();
5612-
APInt DemandedVecElts = APInt::getAllOnes(NumElts);
5611+
DemandedVecElts = APInt::getAllOnes(NumElts);
5612+
auto *CIdx = dyn_cast<ConstantInt>(Op->getOperand(1));
56135613
if (CIdx && CIdx->getValue().ult(NumElts))
56145614
DemandedVecElts = APInt::getOneBitSet(NumElts, CIdx->getZExtValue());
5615-
return computeKnownFPClass(Vec, DemandedVecElts, InterestedClasses, Known,
5616-
Q, Depth + 1);
5617-
}
5615+
} else
5616+
DemandedVecElts = APInt(1, 1);
56185617

5619-
break;
5618+
return computeKnownFPClass(Vec, DemandedVecElts, InterestedClasses, Known,
5619+
Q, Depth + 1);
56205620
}
56215621
case Instruction::InsertElement: {
56225622
if (isa<ScalableVectorType>(Op->getType()))

0 commit comments

Comments
 (0)