@@ -218,6 +218,7 @@ class VJPCloner::Implementation final
218
218
}
219
219
220
220
void visitReturnInst (ReturnInst *ri) {
221
+ Builder.setCurrentDebugScope (getOpScope (ri->getDebugScope ()));
221
222
auto loc = ri->getOperand ().getLoc ();
222
223
// Build pullback struct value for original block.
223
224
auto *origExit = ri->getParent ();
@@ -291,6 +292,7 @@ class VJPCloner::Implementation final
291
292
}
292
293
293
294
void visitBranchInst (BranchInst *bi) {
295
+ Builder.setCurrentDebugScope (getOpScope (bi->getDebugScope ()));
294
296
// Build pullback struct value for original block.
295
297
// Build predecessor enum value for destination block.
296
298
auto *origBB = bi->getParent ();
@@ -310,6 +312,7 @@ class VJPCloner::Implementation final
310
312
}
311
313
312
314
void visitCondBranchInst (CondBranchInst *cbi) {
315
+ Builder.setCurrentDebugScope (getOpScope (cbi->getDebugScope ()));
313
316
// Build pullback struct value for original block.
314
317
auto *pbStructVal = buildPullbackValueStructValue (cbi);
315
318
// Create a new `cond_br` instruction.
@@ -320,6 +323,7 @@ class VJPCloner::Implementation final
320
323
}
321
324
322
325
void visitSwitchEnumTermInst (SwitchEnumTermInst inst) {
326
+ Builder.setCurrentDebugScope (getOpScope (inst->getDebugScope ()));
323
327
// Build pullback struct value for original block.
324
328
auto *pbStructVal = buildPullbackValueStructValue (*inst);
325
329
@@ -360,6 +364,7 @@ class VJPCloner::Implementation final
360
364
}
361
365
362
366
void visitCheckedCastBranchInst (CheckedCastBranchInst *ccbi) {
367
+ Builder.setCurrentDebugScope (getOpScope (ccbi->getDebugScope ()));
363
368
// Build pullback struct value for original block.
364
369
auto *pbStructVal = buildPullbackValueStructValue (ccbi);
365
370
// Create a new `checked_cast_branch` instruction.
@@ -373,6 +378,7 @@ class VJPCloner::Implementation final
373
378
}
374
379
375
380
void visitCheckedCastValueBranchInst (CheckedCastValueBranchInst *ccvbi) {
381
+ Builder.setCurrentDebugScope (getOpScope (ccvbi->getDebugScope ()));
376
382
// Build pullback struct value for original block.
377
383
auto *pbStructVal = buildPullbackValueStructValue (ccvbi);
378
384
// Create a new `checked_cast_value_branch` instruction.
@@ -386,6 +392,7 @@ class VJPCloner::Implementation final
386
392
}
387
393
388
394
void visitCheckedCastAddrBranchInst (CheckedCastAddrBranchInst *ccabi) {
395
+ Builder.setCurrentDebugScope (getOpScope (ccabi->getDebugScope ()));
389
396
// Build pullback struct value for original block.
390
397
auto *pbStructVal = buildPullbackValueStructValue (ccabi);
391
398
// Create a new `checked_cast_addr_branch` instruction.
@@ -437,6 +444,7 @@ class VJPCloner::Implementation final
437
444
return ;
438
445
}
439
446
447
+ Builder.setCurrentDebugScope (getOpScope (ai->getDebugScope ()));
440
448
auto loc = ai->getLoc ();
441
449
auto &builder = getBuilder ();
442
450
auto origCallee = getOpValue (ai->getCallee ());
@@ -698,6 +706,7 @@ class VJPCloner::Implementation final
698
706
}
699
707
700
708
void visitTryApplyInst (TryApplyInst *tai) {
709
+ Builder.setCurrentDebugScope (getOpScope (tai->getDebugScope ()));
701
710
// Build pullback struct value for original block.
702
711
auto *pbStructVal = buildPullbackValueStructValue (tai);
703
712
// Create a new `try_apply` instruction.
@@ -1008,6 +1017,7 @@ SILBasicBlock *VJPCloner::Implementation::createTrampolineBasicBlock(
1008
1017
// In the trampoline block, build predecessor enum value for VJP successor
1009
1018
// block and branch to it.
1010
1019
SILBuilder trampolineBuilder (trampolineBB);
1020
+ trampolineBuilder.setCurrentDebugScope (getOpScope (termInst->getDebugScope ()));
1011
1021
auto *origBB = termInst->getParent ();
1012
1022
auto *succEnumVal =
1013
1023
buildPredecessorEnumValue (trampolineBuilder, origBB, succBB, pbStructVal);
@@ -1032,7 +1042,6 @@ VJPCloner::Implementation::buildPullbackValueStructValue(TermInst *termInst) {
1032
1042
auto *predEnumArg = vjpBB->getArguments ().back ();
1033
1043
bbPullbackValues.insert (bbPullbackValues.begin (), predEnumArg);
1034
1044
}
1035
- getBuilder ().setCurrentDebugScope (getOpScope (termInst->getDebugScope ()));
1036
1045
return getBuilder ().createStruct (loc, structLoweredTy, bbPullbackValues);
1037
1046
}
1038
1047
0 commit comments