Skip to content

Commit efd0af4

Browse files
Simplify code by iterating across all Constant types.
1 parent 0dc732d commit efd0af4

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,13 +1835,8 @@ Value *InstCombinerImpl::SimplifyDemandedVectorElts(Value *V,
18351835
APInt DemandedPtrs(APInt::getAllOnes(VWidth)),
18361836
DemandedPassThrough(DemandedElts);
18371837
if (auto *CMask = dyn_cast<Constant>(II->getOperand(2))) {
1838-
if (CMask->isNullValue())
1839-
DemandedPtrs.clearAllBits();
1840-
else if (CMask->isAllOnesValue())
1841-
DemandedPassThrough.clearAllBits();
1842-
else if (auto *CV = dyn_cast<ConstantVector>(CMask)) {
1843-
for (unsigned i = 0; i < VWidth; i++) {
1844-
Constant *CElt = CV->getAggregateElement(i);
1838+
for (unsigned i = 0; i < VWidth; i++) {
1839+
if (Constant *CElt = CMask->getAggregateElement(i)) {
18451840
if (CElt->isNullValue())
18461841
DemandedPtrs.clearBit(i);
18471842
else if (CElt->isAllOnesValue())

0 commit comments

Comments
 (0)