@@ -418,7 +418,24 @@ bool MoveOnlyChecker::check(NonLocalAccessBlockAnalysis *accessBlockAnalysis,
418
418
LLVM_DEBUG (llvm::dbgs () << " Visiting: " << *markedValue);
419
419
420
420
// First canonicalize ownership.
421
- changed |= canonicalizer.canonicalizeValueLifetime (markedValue);
421
+ if (!canonicalizer.canonicalizeValueLifetime (markedValue)) {
422
+ // If we failed to canonicalize ownership, there was something in the SIL
423
+ // that copy propagation did not understand. Emit a we did not understand
424
+ // error.
425
+ if (markedValue->getType ().isMoveOnlyWrapped ()) {
426
+ diagnose (fn->getASTContext (), markedValue->getLoc ().getSourceLoc (),
427
+ diag::sil_moveonlychecker_not_understand_no_implicit_copy);
428
+ } else {
429
+ diagnose (fn->getASTContext (), markedValue->getLoc ().getSourceLoc (),
430
+ diag::sil_moveonlychecker_not_understand_moveonly);
431
+ }
432
+ valuesWithDiagnostics.insert (markedValue);
433
+ continue ;
434
+ } else {
435
+ // Always set changed to true if we succeeded in canonicalizing since we
436
+ // may have rewritten copies.
437
+ changed = true ;
438
+ }
422
439
423
440
// If we are asked to perform guaranteed checking, emit an error if we have
424
441
// /any/ consuming uses.
@@ -532,6 +549,9 @@ class MoveOnlyCheckerPass : public SILFunctionTransform {
532
549
assert (fn->getModule ().getStage () == SILStage::Raw &&
533
550
" Should only run on Raw SIL" );
534
551
552
+ LLVM_DEBUG (llvm::dbgs () << " ===> MoveOnly Object Checker. Visiting: "
553
+ << fn->getName () << ' \n ' );
554
+
535
555
auto *accessBlockAnalysis = getAnalysis<NonLocalAccessBlockAnalysis>();
536
556
auto *dominanceAnalysis = getAnalysis<DominanceAnalysis>();
537
557
DominanceInfo *domTree = dominanceAnalysis->get (fn);
0 commit comments