@@ -1552,7 +1552,7 @@ bool VectorCombine::foldShuffleOfCastops(Instruction &I) {
1552
1552
// of each lane. If we can simplify away the shuffles to identities then
1553
1553
// do so.
1554
1554
bool VectorCombine::foldShuffleToIdentity (Instruction &I) {
1555
- FixedVectorType *Ty = dyn_cast<FixedVectorType>(I.getType ());
1555
+ auto *Ty = dyn_cast<FixedVectorType>(I.getType ());
1556
1556
if (!Ty || !isa<Instruction>(I.getOperand (0 )) ||
1557
1557
!isa<Instruction>(I.getOperand (1 )))
1558
1558
return false ;
@@ -1565,7 +1565,7 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
1565
1565
cast<FixedVectorType>(SV->getOperand (0 )->getType ())->getNumElements ();
1566
1566
int M = SV->getMaskValue (Lane);
1567
1567
if (M < 0 )
1568
- return {nullptr , - 1 };
1568
+ return {nullptr , PoisonMaskElem };
1569
1569
else if (M < (int )NumElts) {
1570
1570
V = SV->getOperand (0 );
1571
1571
Lane = M;
@@ -1578,12 +1578,12 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
1578
1578
};
1579
1579
1580
1580
auto GenerateInstLaneVectorFromOperand =
1581
- [&LookThroughShuffles](const SmallVector <InstLane> & Item, int Op) {
1581
+ [&LookThroughShuffles](ArrayRef <InstLane> Item, int Op) {
1582
1582
SmallVector<InstLane> NItem;
1583
1583
for (InstLane V : Item) {
1584
1584
NItem.emplace_back (
1585
1585
!V.first
1586
- ? InstLane{nullptr , - 1 }
1586
+ ? InstLane{nullptr , PoisonMaskElem }
1587
1587
: LookThroughShuffles (
1588
1588
cast<Instruction>(V.first )->getOperand (Op), V.second ));
1589
1589
}
@@ -1631,8 +1631,7 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
1631
1631
if (!all_of (drop_begin (Item), [&](InstLane IL) {
1632
1632
if (!IL.first )
1633
1633
return true ;
1634
- if (isa<Instruction>(IL.first ) &&
1635
- !cast<Instruction>(IL.first )->hasOneUse ())
1634
+ if (auto *I = dyn_cast<Instruction>(IL.first ); I && !I->hasOneUse ())
1636
1635
return false ;
1637
1636
return IL.first ->getValueID () == Item[0 ].first ->getValueID () &&
1638
1637
(!isa<IntrinsicInst>(IL.first ) ||
@@ -1654,8 +1653,8 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
1654
1653
1655
1654
// If we got this far, we know the shuffles are superfluous and can be
1656
1655
// removed. Scan through again and generate the new tree of instructions.
1657
- std::function<Value *(const SmallVector <InstLane> & )> generate =
1658
- [&](const SmallVector <InstLane> & Item) -> Value * {
1656
+ std::function<Value *(ArrayRef <InstLane>)> generate =
1657
+ [&](ArrayRef <InstLane> Item) -> Value * {
1659
1658
if (IdentityLeafs.contains (Item[0 ].first ) &&
1660
1659
all_of (drop_begin (enumerate(Item)), [&](const auto &E) {
1661
1660
return !E.value ().first || (E.value ().first == Item[0 ].first &&
0 commit comments