@@ -1672,7 +1672,7 @@ bool VectorCombine::foldShuffleOfShuffles(Instruction &I) {
1672
1672
// of each lane. If we can simplify away the shuffles to identities then
1673
1673
// do so.
1674
1674
bool VectorCombine::foldShuffleToIdentity (Instruction &I) {
1675
- FixedVectorType *Ty = dyn_cast<FixedVectorType>(I.getType ());
1675
+ auto *Ty = dyn_cast<FixedVectorType>(I.getType ());
1676
1676
if (!Ty || !isa<Instruction>(I.getOperand (0 )) ||
1677
1677
!isa<Instruction>(I.getOperand (1 )))
1678
1678
return false ;
@@ -1685,7 +1685,7 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
1685
1685
cast<FixedVectorType>(SV->getOperand (0 )->getType ())->getNumElements ();
1686
1686
int M = SV->getMaskValue (Lane);
1687
1687
if (M < 0 )
1688
- return {nullptr , - 1 };
1688
+ return {nullptr , PoisonMaskElem };
1689
1689
else if (M < (int )NumElts) {
1690
1690
V = SV->getOperand (0 );
1691
1691
Lane = M;
@@ -1698,12 +1698,12 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
1698
1698
};
1699
1699
1700
1700
auto GenerateInstLaneVectorFromOperand =
1701
- [&LookThroughShuffles](const SmallVector <InstLane> & Item, int Op) {
1701
+ [&LookThroughShuffles](ArrayRef <InstLane> Item, int Op) {
1702
1702
SmallVector<InstLane> NItem;
1703
1703
for (InstLane V : Item) {
1704
1704
NItem.emplace_back (
1705
1705
!V.first
1706
- ? InstLane{nullptr , - 1 }
1706
+ ? InstLane{nullptr , PoisonMaskElem }
1707
1707
: LookThroughShuffles (
1708
1708
cast<Instruction>(V.first )->getOperand (Op), V.second ));
1709
1709
}
@@ -1751,8 +1751,7 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
1751
1751
if (!all_of (drop_begin (Item), [&](InstLane IL) {
1752
1752
if (!IL.first )
1753
1753
return true ;
1754
- if (isa<Instruction>(IL.first ) &&
1755
- !cast<Instruction>(IL.first )->hasOneUse ())
1754
+ if (auto *I = dyn_cast<Instruction>(IL.first ); I && !I->hasOneUse ())
1756
1755
return false ;
1757
1756
return IL.first ->getValueID () == Item[0 ].first ->getValueID () &&
1758
1757
(!isa<IntrinsicInst>(IL.first ) ||
@@ -1774,8 +1773,8 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
1774
1773
1775
1774
// If we got this far, we know the shuffles are superfluous and can be
1776
1775
// removed. Scan through again and generate the new tree of instructions.
1777
- std::function<Value *(const SmallVector <InstLane> & )> generate =
1778
- [&](const SmallVector <InstLane> & Item) -> Value * {
1776
+ std::function<Value *(ArrayRef <InstLane>)> generate =
1777
+ [&](ArrayRef <InstLane> Item) -> Value * {
1779
1778
if (IdentityLeafs.contains (Item[0 ].first ) &&
1780
1779
all_of (drop_begin (enumerate(Item)), [&](const auto &E) {
1781
1780
return !E.value ().first || (E.value ().first == Item[0 ].first &&
0 commit comments