@@ -1588,6 +1588,10 @@ class PartitionOpTranslator {
15881588 SmallVector<SILValue, 8 > assignOperands;
15891589 SmallVector<SILValue, 8 > assignResults;
15901590
1591+ // A helper we use to emit an unknown patten error if our merge is
1592+ // invalid. This ensures we guarantee that if we find an actor merge error,
1593+ // the compiler halts. Importantly this lets our users know 100% that if the
1594+ // compiler exits successfully, actor merge errors could not have happened.
15911595 std::optional<SILDynamicMergedIsolationInfo> mergedInfo;
15921596 if (resultIsolationInfoOverride) {
15931597 mergedInfo = resultIsolationInfoOverride;
@@ -1598,12 +1602,26 @@ class PartitionOpTranslator {
15981602 for (SILValue src : sourceValues) {
15991603 if (auto value = tryToTrackValue (src)) {
16001604 assignOperands.push_back (value->getRepresentative ().getValue ());
1601- mergedInfo = mergedInfo->merge (value->getIsolationRegionInfo ());
1605+ auto originalMergedInfo = mergedInfo;
1606+ (void )originalMergedInfo;
1607+ if (mergedInfo)
1608+ mergedInfo = mergedInfo->merge (value->getIsolationRegionInfo ());
16021609
16031610 // If we fail to merge, then we have an incompatibility in between some
16041611 // of our arguments (consider isolated to different actors) or with the
16051612 // isolationInfo we specified. Emit an unknown patten error.
16061613 if (!mergedInfo) {
1614+ LLVM_DEBUG (
1615+ llvm::dbgs () << " Merge Failure!\n "
1616+ << " Original Info: " ;
1617+ if (originalMergedInfo)
1618+ originalMergedInfo->printForDiagnostics (llvm::dbgs ());
1619+ else llvm::dbgs () << " nil" ;
1620+ llvm::dbgs () << " \n Value: "
1621+ << value->getRepresentative ().getValue ();
1622+ llvm::dbgs () << " Value Info: " ;
1623+ value->getIsolationRegionInfo ().printForDiagnostics (llvm::dbgs ());
1624+ llvm::dbgs () << " \n " );
16071625 builder.addUnknownPatternError (src);
16081626 continue ;
16091627 }
@@ -1612,7 +1630,7 @@ class PartitionOpTranslator {
16121630
16131631 for (SILValue result : resultValues) {
16141632 // If we had isolation info explicitly passed in... use our
1615- // mergedInfo . Otherwise, we want to infer.
1633+ // resultIsolationInfoError . Otherwise, we want to infer.
16161634 if (resultIsolationInfoOverride) {
16171635 // We only get back result if it is non-Sendable.
16181636 if (auto nonSendableValue =
@@ -1647,9 +1665,10 @@ class PartitionOpTranslator {
16471665 // derived, introduce a fake element so we just propagate the actor
16481666 // region.
16491667 //
1650- // NOTE: Here we check if we have mergedInfo rather than isolationInfo
1651- // since we want to do this regardless of whether or not we passed in a
1652- // specific isolation info unlike earlier when processing actual results.
1668+ // NOTE: Here we check if we have resultIsolationInfoOverride rather than
1669+ // isolationInfo since we want to do this regardless of whether or not we
1670+ // passed in a specific isolation info unlike earlier when processing
1671+ // actual results.
16531672 if (assignOperands.size () && resultIsolationInfoOverride) {
16541673 builder.addActorIntroducingInst (assignOperands.back (),
16551674 resultIsolationInfoOverride);
0 commit comments