Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions llvm/lib/Analysis/ValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5604,19 +5604,20 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
// Look through extract element. If the index is non-constant or
// out-of-range demand all elements, otherwise just the extracted element.
const Value *Vec = Op->getOperand(0);
const Value *Idx = Op->getOperand(1);
auto *CIdx = dyn_cast<ConstantInt>(Idx);

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

break;
return computeKnownFPClass(Vec, DemandedVecElts, InterestedClasses, Known,
Q, Depth + 1);
}
case Instruction::InsertElement: {
if (isa<ScalableVectorType>(Op->getType()))
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/Attributor/nofpclass.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ define float @returned_extractelement_index_oob(<4 x float> nofpclass(nan) %vec)

define float @returned_extractelement_scalable(<vscale x 4 x float> nofpclass(nan) %vec) {
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
; CHECK-LABEL: define float @returned_extractelement_scalable
; CHECK-LABEL: define nofpclass(nan) float @returned_extractelement_scalable
; CHECK-SAME: (<vscale x 4 x float> nofpclass(nan) [[VEC:%.*]]) #[[ATTR3]] {
; CHECK-NEXT: [[EXTRACT:%.*]] = extractelement <vscale x 4 x float> [[VEC]], i32 0
; CHECK-NEXT: ret float [[EXTRACT]]
Expand Down
Loading