File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
include/swift/SILOptimizer/Utils Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -342,11 +342,7 @@ class CanonicalizeOSSALifetime final {
342
342
void initializeLiveness (SILValue def,
343
343
ArrayRef<SILInstruction *> lexicalLifetimeEnds) {
344
344
assert (consumingBlocks.empty () && debugValues.empty ());
345
- // Clear the cached analysis pointer just in case the client invalidates the
346
- // analysis, freeing its memory.
347
- accessBlocks = nullptr ;
348
- consumes.clear ();
349
- destroys.clear ();
345
+ clear ();
350
346
351
347
currentDef = def;
352
348
currentLexicalLifetimeEnds = lexicalLifetimeEnds;
@@ -358,9 +354,18 @@ class CanonicalizeOSSALifetime final {
358
354
}
359
355
360
356
void clear () {
357
+ // Clear the access blocks analysis pointer in case the client invalidates
358
+ // the analysis. If the client did, the analysis will be recomputed in
359
+ // extendLivenessThroughOverlappingAccess; if it didn't, the analysis
360
+ // pointer will just be set back to its old value when the analysis' cache
361
+ // is consulted in extendLivenessThroughOverlappingAccess.
362
+ accessBlocks = nullptr ;
363
+
361
364
consumingBlocks.clear ();
362
365
debugValues.clear ();
363
366
discoveredBlocks.clear ();
367
+ consumes.clear ();
368
+ destroys.clear ();
364
369
}
365
370
366
371
// / Top-Level API: rewrites copies and destroys within \p def's extended
Original file line number Diff line number Diff line change @@ -1241,7 +1241,6 @@ void CanonicalizeOSSALifetime::rewriteLifetimes() {
1241
1241
rewriteCopies ();
1242
1242
1243
1243
clear ();
1244
- consumes.clear ();
1245
1244
}
1246
1245
1247
1246
// / Canonicalize a single extended owned lifetime.
You can’t perform that action at this time.
0 commit comments