@@ -1590,6 +1590,10 @@ class PartitionOpTranslator {
15901590 SmallVector<SILValue, 8 > assignOperands;
15911591 SmallVector<SILValue, 8 > assignResults;
15921592
1593+ // A helper we use to emit an unknown patten error if our merge is
1594+ // invalid. This ensures we guarantee that if we find an actor merge error,
1595+ // the compiler halts. Importantly this lets our users know 100% that if the
1596+ // compiler exits successfully, actor merge errors could not have happened.
15931597 std::optional<SILDynamicMergedIsolationInfo> mergedInfo;
15941598 if (resultIsolationInfoOverride) {
15951599 mergedInfo = resultIsolationInfoOverride;
@@ -1600,12 +1604,26 @@ class PartitionOpTranslator {
16001604 for (SILValue src : sourceValues) {
16011605 if (auto value = tryToTrackValue (src)) {
16021606 assignOperands.push_back (value->getRepresentative ().getValue ());
1603- mergedInfo = mergedInfo->merge (value->getIsolationRegionInfo ());
1607+ auto originalMergedInfo = mergedInfo;
1608+ (void )originalMergedInfo;
1609+ if (mergedInfo)
1610+ mergedInfo = mergedInfo->merge (value->getIsolationRegionInfo ());
16041611
16051612 // If we fail to merge, then we have an incompatibility in between some
16061613 // of our arguments (consider isolated to different actors) or with the
16071614 // isolationInfo we specified. Emit an unknown patten error.
16081615 if (!mergedInfo) {
1616+ LLVM_DEBUG (
1617+ llvm::dbgs () << " Merge Failure!\n "
1618+ << " Original Info: " ;
1619+ if (originalMergedInfo)
1620+ originalMergedInfo->printForDiagnostics (llvm::dbgs ());
1621+ else llvm::dbgs () << " nil" ;
1622+ llvm::dbgs () << " \n Value: "
1623+ << value->getRepresentative ().getValue ();
1624+ llvm::dbgs () << " Value Info: " ;
1625+ value->getIsolationRegionInfo ().printForDiagnostics (llvm::dbgs ());
1626+ llvm::dbgs () << " \n " );
16091627 builder.addUnknownPatternError (src);
16101628 continue ;
16111629 }
@@ -1614,7 +1632,7 @@ class PartitionOpTranslator {
16141632
16151633 for (SILValue result : resultValues) {
16161634 // If we had isolation info explicitly passed in... use our
1617- // mergedInfo . Otherwise, we want to infer.
1635+ // resultIsolationInfoError . Otherwise, we want to infer.
16181636 if (resultIsolationInfoOverride) {
16191637 // We only get back result if it is non-Sendable.
16201638 if (auto nonSendableValue =
@@ -1657,9 +1675,10 @@ class PartitionOpTranslator {
16571675 // derived, introduce a fake element so we just propagate the actor
16581676 // region.
16591677 //
1660- // NOTE: Here we check if we have mergedInfo rather than isolationInfo
1661- // since we want to do this regardless of whether or not we passed in a
1662- // specific isolation info unlike earlier when processing actual results.
1678+ // NOTE: Here we check if we have resultIsolationInfoOverride rather than
1679+ // isolationInfo since we want to do this regardless of whether or not we
1680+ // passed in a specific isolation info unlike earlier when processing
1681+ // actual results.
16631682 if (assignOperands.size () && resultIsolationInfoOverride) {
16641683 builder.addActorIntroducingInst (assignOperands.back (),
16651684 resultIsolationInfoOverride);
0 commit comments