@@ -277,20 +277,12 @@ bool IsAddressWrittenToDefUseAnalysis::isWrittenToHelper(SILValue initialValue)
277
277
278
278
namespace {
279
279
280
- // / A two stage visitor that optimizes ownership instructions and eliminates any
281
- // / trivially dead code that results after optimization. The two stages are used
282
- // / to avoid iterator invalidation. Specifically:
283
- // /
284
- // / 1. We first process the CFG instruction by instruction, only eliminating
285
- // / instructions that are guaranteed to be dominated by the visited
286
- // / instrution. While we do that, we add the operands of any instruction that we
287
- // / successfully optimize to the worklist. NOTE: We do not process arguments
288
- // / here to get SSA guarantees around dominance.
289
- // /
290
- // / 2. Once we have processed the CFG and done some initial optimization, we
291
- // / enter phase 2 where we process the worklist. Here we are allowed to process
292
- // / arbitrary values and instructions, removing things that we are erasing from
293
- // / the worklist before we delete them.
280
+ // / A visitor that optimizes ownership instructions and eliminates any trivially
281
+ // / dead code that results after optimization. It uses an internal worklist that
282
+ // / is initialized on construction with targets to avoid iterator invalidation
283
+ // / issues. Rather than revisit the entire CFG like SILCombine and other
284
+ // / visitors do, we maintain a visitedSinceLastMutation list to ensure that we
285
+ // / revisit all interesting instructions in between mutations.
294
286
struct SemanticARCOptVisitor
295
287
: SILInstructionVisitor<SemanticARCOptVisitor, bool > {
296
288
// / Our main worklist. We use this after an initial run through.
0 commit comments