Skip to content

Commit 7f426d1

Browse files
committed
Revert "[semantic-arc-opts] Refactor out reinitializing the worklist into method drainVisitedSinceLastMutationIntoWorklist and add some types/comments."
This reverts commit d0d31f7.
1 parent 7c5d74e commit 7f426d1

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

lib/SILOptimizer/Transforms/SemanticARCOpts.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -673,18 +673,6 @@ struct SemanticARCOptVisitor
673673
eraseInstruction(i);
674674
}
675675

676-
/// Pop values off of visitedSinceLastMutation, adding .some values to the
677-
/// worklist.
678-
void drainVisitedSinceLastMutationIntoWorklist() {
679-
while (!visitedSinceLastMutation.empty()) {
680-
Optional<SILValue> nextValue = visitedSinceLastMutation.pop_back_val();
681-
if (!nextValue.hasValue()) {
682-
continue;
683-
}
684-
worklist.insert(*nextValue);
685-
}
686-
}
687-
688676
/// Remove all results of the given instruction from the worklist and then
689677
/// erase the instruction. Assumes that the instruction does not have any
690678
/// users left.
@@ -698,7 +686,13 @@ struct SemanticARCOptVisitor
698686
i->eraseFromParent();
699687

700688
// Add everything else from visitedSinceLastMutation to the worklist.
701-
drainVisitedSinceLastMutationIntoWorklist();
689+
for (auto opt : visitedSinceLastMutation) {
690+
if (!opt.hasValue()) {
691+
continue;
692+
}
693+
worklist.insert(*opt);
694+
}
695+
visitedSinceLastMutation.clear();
702696
}
703697

704698
InstModCallbacks getCallbacks() {
@@ -1004,9 +998,14 @@ bool SemanticARCOptVisitor::optimize() {
1004998
assumingAtFixedPoint = true;
1005999
SWIFT_DEFER { assumingAtFixedPoint = false; };
10061000

1007-
// Add everything in visitedSinceLastMutation to the worklist so we
1008-
// recompute our fixed point.
1009-
drainVisitedSinceLastMutationIntoWorklist();
1001+
// Add everything in visitedSinceLastMutation to the worklist.
1002+
for (auto opt : visitedSinceLastMutation) {
1003+
if (!opt.hasValue()) {
1004+
continue;
1005+
}
1006+
worklist.insert(*opt);
1007+
}
1008+
visitedSinceLastMutation.clear();
10101009

10111010
// Then re-run the worklist. We shouldn't modify anything since we are at a
10121011
// fixed point and are just using this to seed the

0 commit comments

Comments
 (0)