@@ -875,27 +875,37 @@ struct PartitionOpEvaluator {
875
875
apply (o);
876
876
}
877
877
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
+
878
886
private:
879
887
// Private helper that squelches the error if our transfer instruction and our
880
888
// use have the same isolation.
881
889
void
882
890
handleLocalUseAfterTransferHelper (const PartitionOp &op, Element elt,
883
891
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
+ }
889
898
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
+ }
899
909
}
900
910
901
911
// Ok, we actually need to emit a call to the callback.
@@ -970,6 +980,9 @@ struct PartitionOpEvaluatorBaseImpl : PartitionOpEvaluator<Subclass> {
970
980
// / to access the instruction in the evaluator which creates a problem when
971
981
// / since the operand we pass in is a dummy operand.
972
982
bool isClosureCaptured (Element elt, Operand *op) const { return false ; }
983
+
984
+ // / By default squelch errors.
985
+ bool shouldTryToSquelchErrors () const { return true ; }
973
986
};
974
987
975
988
// / A subclass of PartitionOpEvaluatorBaseImpl that doesn't have any special
0 commit comments