@@ -875,27 +875,37 @@ struct PartitionOpEvaluator {
875875 apply (o);
876876 }
877877
878+ // / Provides a way for subclasses to disable the error squelching
879+ // / functionality.
880+ // /
881+ // / Used by the unittests.
882+ bool shouldTryToSquelchErrors () const {
883+ return asImpl ().shouldTryToSquelchErrors ();
884+ }
885+
878886private:
879887 // Private helper that squelches the error if our transfer instruction and our
880888 // use have the same isolation.
881889 void
882890 handleLocalUseAfterTransferHelper (const PartitionOp &op, Element elt,
883891 TransferringOperand *transferringOp) const {
884- if (auto isolationInfo = SILIsolationInfo::get (op.getSourceInst ())) {
885- if (isolationInfo.isActorIsolated () &&
886- isolationInfo == SILIsolationInfo::get (transferringOp->getUser ()))
887- return ;
888- }
892+ if (shouldTryToSquelchErrors ()) {
893+ if (auto isolationInfo = SILIsolationInfo::get (op.getSourceInst ())) {
894+ if (isolationInfo.isActorIsolated () &&
895+ isolationInfo == SILIsolationInfo::get (transferringOp->getUser ()))
896+ return ;
897+ }
889898
890- // If our instruction does not have any isolation info associated with it,
891- // it must be nonisolated. See if our function has a matching isolation to
892- // our transferring operand. If so, we can squelch this.
893- if (auto functionIsolation =
894- transferringOp->getUser ()->getFunction ()->getActorIsolation ()) {
895- if (functionIsolation->isActorIsolated () &&
896- SILIsolationInfo::getActorIsolated (*functionIsolation) ==
897- SILIsolationInfo::get (transferringOp->getUser ()))
898- return ;
899+ // If our instruction does not have any isolation info associated with it,
900+ // it must be nonisolated. See if our function has a matching isolation to
901+ // our transferring operand. If so, we can squelch this.
902+ if (auto functionIsolation =
903+ transferringOp->getUser ()->getFunction ()->getActorIsolation ()) {
904+ if (functionIsolation->isActorIsolated () &&
905+ SILIsolationInfo::getActorIsolated (*functionIsolation) ==
906+ SILIsolationInfo::get (transferringOp->getUser ()))
907+ return ;
908+ }
899909 }
900910
901911 // Ok, we actually need to emit a call to the callback.
@@ -970,6 +980,9 @@ struct PartitionOpEvaluatorBaseImpl : PartitionOpEvaluator<Subclass> {
970980 // / to access the instruction in the evaluator which creates a problem when
971981 // / since the operand we pass in is a dummy operand.
972982 bool isClosureCaptured (Element elt, Operand *op) const { return false ; }
983+
984+ // / By default squelch errors.
985+ bool shouldTryToSquelchErrors () const { return true ; }
973986};
974987
975988// / A subclass of PartitionOpEvaluatorBaseImpl that doesn't have any special
0 commit comments