Skip to content

Commit 2e819a1

Browse files
Use nicer syntax to compute DemandedElt.
1 parent d4e9e6b commit 2e819a1

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5141,10 +5141,9 @@ bool SelectionDAG::isGuaranteedNotToBeUndefOrPoison(SDValue Op, bool PoisonOnly,
51415141
return true;
51425142

51435143
EVT VT = Op.getValueType();
5144-
APInt DemandedElts =
5145-
VT.isVector() ? APInt::getAllOnes(
5146-
VT.isScalableVector() ? 1 : VT.getVectorNumElements())
5147-
: APInt(1, 1);
5144+
APInt DemandedElts = VT.isFixedLengthVector()
5145+
? APInt::getAllOnes(VT.getVectorNumElements())
5146+
: APInt(1, 1);
51485147
return isGuaranteedNotToBeUndefOrPoison(Op, DemandedElts, PoisonOnly, Depth);
51495148
}
51505149

@@ -5237,14 +5236,10 @@ bool SelectionDAG::isGuaranteedNotToBeUndefOrPoison(SDValue Op,
52375236
bool SelectionDAG::canCreateUndefOrPoison(SDValue Op, bool PoisonOnly,
52385237
bool ConsiderFlags,
52395238
unsigned Depth) const {
5240-
// Since the number of lanes in a scalable vector is unknown at compile time,
5241-
// we track one bit which is implicitly broadcast to all lanes. This means
5242-
// that all lanes in a scalable vector are considered demanded.
52435239
EVT VT = Op.getValueType();
5244-
APInt DemandedElts =
5245-
VT.isVector() ? APInt::getAllOnes(
5246-
VT.isScalableVector() ? 1 : VT.getVectorNumElements())
5247-
: APInt(1, 1);
5240+
APInt DemandedElts = VT.isFixedLengthVector()
5241+
? APInt::getAllOnes(VT.getVectorNumElements())
5242+
: APInt(1, 1);
52485243
return canCreateUndefOrPoison(Op, DemandedElts, PoisonOnly, ConsiderFlags,
52495244
Depth);
52505245
}

0 commit comments

Comments
 (0)