@@ -3050,6 +3050,9 @@ class UseRewriter : SILInstructionVisitor<UseRewriter> {
3050
3050
}
3051
3051
}
3052
3052
3053
+ template <typename Introducer>
3054
+ void visitLifetimeIntroducer (Introducer *introducer);
3055
+
3053
3056
void visitBeginBorrowInst (BeginBorrowInst *borrow);
3054
3057
3055
3058
void visitEndBorrowInst (EndBorrowInst *end) {}
@@ -3263,15 +3266,16 @@ void UseRewriter::rewriteDestructure(SILInstruction *destructure) {
3263
3266
}
3264
3267
}
3265
3268
3266
- void UseRewriter::visitBeginBorrowInst (BeginBorrowInst *borrow) {
3267
- assert (use == getProjectedDefOperand (borrow));
3269
+ template <typename Introducer>
3270
+ void UseRewriter::visitLifetimeIntroducer (Introducer *introducer) {
3271
+ assert (use == getProjectedDefOperand (introducer));
3268
3272
3269
3273
// Mark the value as rewritten and use the operand's storage.
3270
3274
auto address = pass.valueStorageMap .getStorage (use->get ()).storageAddress ;
3271
- markRewritten (borrow , address);
3275
+ markRewritten (introducer , address);
3272
3276
3273
- // Borrows are irrelevant unless they are marked lexical.
3274
- if (borrow ->isLexical ()) {
3277
+ // Lifetime introducers are irrelevant unless they are marked lexical.
3278
+ if (introducer ->isLexical ()) {
3275
3279
if (auto base = getAccessBase (address)) {
3276
3280
if (auto *allocStack = dyn_cast<AllocStackInst>(base)) {
3277
3281
allocStack->setIsLexical ();
@@ -3287,6 +3291,10 @@ void UseRewriter::visitBeginBorrowInst(BeginBorrowInst *borrow) {
3287
3291
}
3288
3292
}
3289
3293
3294
+ void UseRewriter::visitBeginBorrowInst (BeginBorrowInst *borrow) {
3295
+ visitLifetimeIntroducer (borrow);
3296
+ }
3297
+
3290
3298
// Opening an opaque existential. Rewrite the opened existentials here on
3291
3299
// the use-side because it may produce either loadable or address-only
3292
3300
// types.
0 commit comments