Skip to content

Commit ecbd30a

Browse files
committed
address review feedback
1 parent 228c829 commit ecbd30a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,13 +1543,12 @@ hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1,
15431543
SmallVector<CurrentAndEndIt> Itrs;
15441544
Itrs.reserve(OtherInsts.size() + 1);
15451545
// 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;
15501549
};
15511550
// Return true if all Current are identical.
1552-
auto allIdentical = [&]() {
1551+
auto allIdentical = [](const SmallVector<CurrentAndEndIt> &Itrs) {
15531552
return all_of(make_first_range(ArrayRef(Itrs).drop_front()),
15541553
[&](DPValue::self_iterator I) {
15551554
return Itrs[0].first->isIdenticalToWhenDefined(*I);
@@ -1570,8 +1569,8 @@ hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1,
15701569
// the lock-step DPValues are identical, hoist all of them to TI.
15711570
// This replicates the dbg.* intrinsic behaviour in
15721571
// hoistCommonCodeFromSuccessors.
1573-
while (!atEnd()) {
1574-
bool HoistDPVs = allIdentical();
1572+
while (none_of(Itrs, atEnd)) {
1573+
bool HoistDPVs = allIdentical(Itrs);
15751574
for (CurrentAndEndIt &Pair : Itrs) {
15761575
// Increment Current iterator now as we may be about to move the DPValue.
15771576
DPValue &DPV = *Pair.first++;
@@ -1735,7 +1734,7 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(BasicBlock *BB,
17351734
} else {
17361735
// For a normal instruction, we just move one to right before the
17371736
// 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.
17391738
hoistLockstepIdenticalDPValues(TI, I1, OtherInsts);
17401739
// We've just hoisted DPValues; move I1 after them (before TI) and
17411740
// leave any that were not hoisted behind (by calling moveBefore

0 commit comments

Comments
 (0)