@@ -1588,6 +1588,10 @@ class PartitionOpTranslator {
1588
1588
SmallVector<SILValue, 8 > assignOperands;
1589
1589
SmallVector<SILValue, 8 > assignResults;
1590
1590
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.
1591
1595
std::optional<SILDynamicMergedIsolationInfo> mergedInfo;
1592
1596
if (resultIsolationInfoOverride) {
1593
1597
mergedInfo = resultIsolationInfoOverride;
@@ -1598,12 +1602,26 @@ class PartitionOpTranslator {
1598
1602
for (SILValue src : sourceValues) {
1599
1603
if (auto value = tryToTrackValue (src)) {
1600
1604
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 ());
1602
1609
1603
1610
// If we fail to merge, then we have an incompatibility in between some
1604
1611
// of our arguments (consider isolated to different actors) or with the
1605
1612
// isolationInfo we specified. Emit an unknown patten error.
1606
1613
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 " );
1607
1625
builder.addUnknownPatternError (src);
1608
1626
continue ;
1609
1627
}
@@ -1612,7 +1630,7 @@ class PartitionOpTranslator {
1612
1630
1613
1631
for (SILValue result : resultValues) {
1614
1632
// If we had isolation info explicitly passed in... use our
1615
- // mergedInfo . Otherwise, we want to infer.
1633
+ // resultIsolationInfoError . Otherwise, we want to infer.
1616
1634
if (resultIsolationInfoOverride) {
1617
1635
// We only get back result if it is non-Sendable.
1618
1636
if (auto nonSendableValue =
@@ -1647,9 +1665,10 @@ class PartitionOpTranslator {
1647
1665
// derived, introduce a fake element so we just propagate the actor
1648
1666
// region.
1649
1667
//
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.
1653
1672
if (assignOperands.size () && resultIsolationInfoOverride) {
1654
1673
builder.addActorIntroducingInst (assignOperands.back (),
1655
1674
resultIsolationInfoOverride);
0 commit comments