@@ -1543,13 +1543,12 @@ hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1,
1543
1543
SmallVector<CurrentAndEndIt> Itrs;
1544
1544
Itrs.reserve (OtherInsts.size () + 1 );
1545
1545
// Helper lambdas for lock-step checks:
1546
- // Return true if any Current == End.
1547
- auto atEnd = [&]() {
1548
- return any_of (Itrs,
1549
- [](const CurrentAndEndIt &P) { return P.first == P.second ; });
1546
+ // Return true if this Current == End.
1547
+ auto atEnd = [](const CurrentAndEndIt &Pair) {
1548
+ return Pair.first == Pair.second ;
1550
1549
};
1551
1550
// Return true if all Current are identical.
1552
- auto allIdentical = [&]( ) {
1551
+ auto allIdentical = []( const SmallVector<CurrentAndEndIt> &Itrs ) {
1553
1552
return all_of (make_first_range (ArrayRef (Itrs).drop_front ()),
1554
1553
[&](DPValue::self_iterator I) {
1555
1554
return Itrs[0 ].first ->isIdenticalToWhenDefined (*I);
@@ -1570,8 +1569,8 @@ hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1,
1570
1569
// the lock-step DPValues are identical, hoist all of them to TI.
1571
1570
// This replicates the dbg.* intrinsic behaviour in
1572
1571
// hoistCommonCodeFromSuccessors.
1573
- while (! atEnd ( )) {
1574
- bool HoistDPVs = allIdentical ();
1572
+ while (none_of (Itrs, atEnd )) {
1573
+ bool HoistDPVs = allIdentical (Itrs );
1575
1574
for (CurrentAndEndIt &Pair : Itrs) {
1576
1575
// Increment Current iterator now as we may be about to move the DPValue.
1577
1576
DPValue &DPV = *Pair.first ++;
@@ -1735,7 +1734,7 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(BasicBlock *BB,
1735
1734
} else {
1736
1735
// For a normal instruction, we just move one to right before the
1737
1736
// branch, then replace all uses of the other with the first. Finally,
1738
- // we remove the now redundant second instruction.s
1737
+ // we remove the now redundant second instruction.
1739
1738
hoistLockstepIdenticalDPValues (TI, I1, OtherInsts);
1740
1739
// We've just hoisted DPValues; move I1 after them (before TI) and
1741
1740
// leave any that were not hoisted behind (by calling moveBefore
0 commit comments