@@ -501,35 +501,28 @@ bool swift::shrinkBorrowScope(
501
501
namespace swift ::test {
502
502
// Arguments:
503
503
// - BeginBorrowInst - the introducer for the scope to shrink
504
- // - bool - the expected return value of shrinkBorrowScope
505
- // - variadic list of values consisting of the copies expected to be rewritten
506
504
// Dumps:
507
505
// - DELETED: <<instruction deleted>>
508
506
static FunctionTest ShrinkBorrowScopeTest (
509
- " shrink-borrow-scope " , [](auto &function, auto &arguments, auto &test) {
507
+ " shrink_borrow_scope " , [](auto &function, auto &arguments, auto &test) {
510
508
auto instruction = arguments.takeValue ();
511
- auto expected = arguments.takeBool ();
512
509
auto *bbi = cast<BeginBorrowInst>(instruction);
513
510
auto *analysis = test.template getAnalysis <BasicCalleeAnalysis>();
514
511
SmallVector<CopyValueInst *, 4 > modifiedCopyValueInsts;
515
512
InstructionDeleter deleter (
516
513
InstModCallbacks ().onDelete ([&](auto *instruction) {
517
514
llvm::outs () << " DELETED:\n " ;
518
515
instruction->print (llvm::outs ());
516
+ instruction->eraseFromParent ();
517
+
519
518
}));
520
519
auto shrunk =
521
520
shrinkBorrowScope (*bbi, deleter, analysis, modifiedCopyValueInsts);
522
- unsigned index = 0 ;
521
+ auto *shrunkString = shrunk ? " shrunk" : " did not shrink" ;
522
+ llvm::outs () << " Result: " << shrunkString << " \n " ;
523
+ llvm::outs () << " Rewrote the following copies:\n " ;
523
524
for (auto *cvi : modifiedCopyValueInsts) {
524
- auto expectedCopy = arguments.takeValue ();
525
- llvm::outs () << " rewritten copy " << index << " :\n " ;
526
- llvm::outs () << " expected:\n " ;
527
- expectedCopy->print (llvm::outs ());
528
- llvm::outs () << " got:\n " ;
529
525
cvi->print (llvm::outs ());
530
- assert (cvi == expectedCopy);
531
- ++index;
532
526
}
533
- assert (expected == shrunk && " didn't shrink expectedly!?" );
534
527
});
535
528
} // namespace swift::test
0 commit comments