@@ -501,35 +501,28 @@ bool swift::shrinkBorrowScope(
501501namespace swift ::test {
502502// Arguments:
503503// - 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
506504// Dumps:
507505// - DELETED: <<instruction deleted>>
508506static FunctionTest ShrinkBorrowScopeTest (
509- " shrink-borrow-scope " , [](auto &function, auto &arguments, auto &test) {
507+ " shrink_borrow_scope " , [](auto &function, auto &arguments, auto &test) {
510508 auto instruction = arguments.takeValue ();
511- auto expected = arguments.takeBool ();
512509 auto *bbi = cast<BeginBorrowInst>(instruction);
513510 auto *analysis = test.template getAnalysis <BasicCalleeAnalysis>();
514511 SmallVector<CopyValueInst *, 4 > modifiedCopyValueInsts;
515512 InstructionDeleter deleter (
516513 InstModCallbacks ().onDelete ([&](auto *instruction) {
517514 llvm::outs () << " DELETED:\n " ;
518515 instruction->print (llvm::outs ());
516+ instruction->eraseFromParent ();
517+
519518 }));
520519 auto shrunk =
521520 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 " ;
523524 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 " ;
529525 cvi->print (llvm::outs ());
530- assert (cvi == expectedCopy);
531- ++index;
532526 }
533- assert (expected == shrunk && " didn't shrink expectedly!?" );
534527 });
535528} // namespace swift::test
0 commit comments