Skip to content

Commit bdf428a

Browse files
committed
ValueTracking: Consider demanded elts for vector constants in computeKnownFPClass
1 parent f139387 commit bdf428a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

llvm/lib/Analysis/ValueTracking.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4524,6 +4524,9 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
45244524
// For vectors, verify that each element is not NaN.
45254525
unsigned NumElts = VFVTy->getNumElements();
45264526
for (unsigned i = 0; i != NumElts; ++i) {
4527+
if (!DemandedElts[i])
4528+
continue;
4529+
45274530
Constant *Elt = CV->getAggregateElement(i);
45284531
if (!Elt) {
45294532
Known = KnownFPClass();

llvm/test/Transforms/Attributor/nofpclass.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ define float @shufflevector_extractelt3(<2 x float> %arg0, <2 x float> nofpclass
18021802

18031803
define float @shufflevector_constantdatavector_demanded0() {
18041804
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1805-
; CHECK-LABEL: define nofpclass(snan inf nzero sub nnorm) float @shufflevector_constantdatavector_demanded0
1805+
; CHECK-LABEL: define nofpclass(nan inf zero sub nnorm) float @shufflevector_constantdatavector_demanded0
18061806
; CHECK-SAME: () #[[ATTR3]] {
18071807
; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <3 x float> <float 1.000000e+00, float 0x7FF8000000000000, float 0.000000e+00>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
18081808
; CHECK-NEXT: [[EXTRACT:%.*]] = extractelement <2 x float> [[SHUFFLE]], i32 0
@@ -1815,7 +1815,7 @@ define float @shufflevector_constantdatavector_demanded0() {
18151815

18161816
define float @shufflevector_constantdatavector_demanded1() {
18171817
; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
1818-
; CHECK-LABEL: define nofpclass(snan inf nzero sub nnorm) float @shufflevector_constantdatavector_demanded1
1818+
; CHECK-LABEL: define nofpclass(nan inf nzero sub norm) float @shufflevector_constantdatavector_demanded1
18191819
; CHECK-SAME: () #[[ATTR3]] {
18201820
; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <3 x float> <float 1.000000e+00, float 0x7FF8000000000000, float 0.000000e+00>, <3 x float> poison, <2 x i32> <i32 0, i32 2>
18211821
; CHECK-NEXT: [[EXTRACT:%.*]] = extractelement <2 x float> [[SHUFFLE]], i32 1

0 commit comments

Comments
 (0)