File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -1788,8 +1788,23 @@ static bool visitRecursivelyLifetimeEndingUses(
17881788
17891789 // There shouldn't be any dead-end consumptions of a nonescaping
17901790 // partial_apply that don't forward it along, aside from destroy_value.
1791- assert (use->getUser ()->hasResults ()
1792- && use->getUser ()->getNumResults () == 1 );
1791+ //
1792+ // On-stack partial_apply cannot be cloned, so it should never be used by a
1793+ // BranchInst.
1794+ //
1795+ // This is a fatal error because it performs SIL verification that is not
1796+ // separately checked in the verifier. It is the only check that verifies
1797+ // the structural requirements of on-stack partial_apply uses.
1798+ auto *user = use->getUser ();
1799+ if (user->getNumResults () != 1 ) {
1800+ llvm::errs () << " partial_apply [on_stack] use:\n " ;
1801+ user->printInContext (llvm::errs ());
1802+ if (isa<BranchInst>(user)) {
1803+ llvm::report_fatal_error (" partial_apply [on_stack] cannot be cloned" );
1804+ }
1805+ llvm::report_fatal_error (" partial_apply [on_stack] must be directly "
1806+ " forwarded to a destroy_value" );
1807+ }
17931808 if (!visitRecursivelyLifetimeEndingUses (use->getUser ()->getResult (0 ),
17941809 noUsers, func)) {
17951810 return false ;
You can’t perform that action at this time.
0 commit comments