@@ -1590,6 +1590,10 @@ class PartitionOpTranslator {
1590
1590
SmallVector<SILValue, 8 > assignOperands;
1591
1591
SmallVector<SILValue, 8 > assignResults;
1592
1592
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.
1593
1597
std::optional<SILDynamicMergedIsolationInfo> mergedInfo;
1594
1598
if (resultIsolationInfoOverride) {
1595
1599
mergedInfo = resultIsolationInfoOverride;
@@ -1600,12 +1604,26 @@ class PartitionOpTranslator {
1600
1604
for (SILValue src : sourceValues) {
1601
1605
if (auto value = tryToTrackValue (src)) {
1602
1606
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 ());
1604
1611
1605
1612
// If we fail to merge, then we have an incompatibility in between some
1606
1613
// of our arguments (consider isolated to different actors) or with the
1607
1614
// isolationInfo we specified. Emit an unknown patten error.
1608
1615
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 " );
1609
1627
builder.addUnknownPatternError (src);
1610
1628
continue ;
1611
1629
}
@@ -1614,7 +1632,7 @@ class PartitionOpTranslator {
1614
1632
1615
1633
for (SILValue result : resultValues) {
1616
1634
// If we had isolation info explicitly passed in... use our
1617
- // mergedInfo . Otherwise, we want to infer.
1635
+ // resultIsolationInfoError . Otherwise, we want to infer.
1618
1636
if (resultIsolationInfoOverride) {
1619
1637
// We only get back result if it is non-Sendable.
1620
1638
if (auto nonSendableValue =
@@ -1657,9 +1675,10 @@ class PartitionOpTranslator {
1657
1675
// derived, introduce a fake element so we just propagate the actor
1658
1676
// region.
1659
1677
//
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.
1663
1682
if (assignOperands.size () && resultIsolationInfoOverride) {
1664
1683
builder.addActorIntroducingInst (assignOperands.back (),
1665
1684
resultIsolationInfoOverride);
0 commit comments