Skip to content

Commit fd863f9

Browse files
authored
Merge pull request #75841 from gottesmm/pr-4c4ea8453f92202322e4254fa1156e77a0716bc3
[region-isolation] Improve debug logging
2 parents a68cbb6 + 8a20df1 commit fd863f9

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

include/swift/SILOptimizer/Utils/SILIsolationInfo.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,12 @@ class SILIsolationInfo {
323323
return (kind == Task || kind == Actor) && bool(isolatedValue);
324324
}
325325

326+
SILValue maybeGetIsolatedValue() const {
327+
if (!hasIsolatedValue())
328+
return {};
329+
return getIsolatedValue();
330+
}
331+
326332
static SILIsolationInfo getDisconnected(bool isUnsafeNonIsolated) {
327333
return {Kind::Disconnected,
328334
isUnsafeNonIsolated ? Flag::UnsafeNonIsolated : Flag::None};

lib/SILOptimizer/Mandatory/TransferNonSendable.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,8 +2216,17 @@ struct DiagnosticEvaluator final
22162216
<< " Rep: "
22172217
<< *info->getValueMap().getRepresentative(transferredVal)
22182218
<< " Dynamic Isolation Region: ";
2219-
isolationRegionInfo.printForDiagnostics(llvm::dbgs());
2220-
llvm::dbgs() << '\n');
2219+
isolationRegionInfo.printForOneLineLogging(llvm::dbgs());
2220+
llvm::dbgs() << '\n';
2221+
if (auto isolatedValue = isolationRegionInfo->maybeGetIsolatedValue()) {
2222+
llvm::dbgs() << " Isolated Value: " << isolatedValue;
2223+
auto name = inferNameHelper(isolatedValue);
2224+
llvm::dbgs() << " Isolated Value Name: "
2225+
<< (name.has_value() ? name->get() : "none") << '\n';
2226+
} else {
2227+
llvm::dbgs() << " Isolated Value: none\n";
2228+
}
2229+
);
22212230
auto *self = const_cast<DiagnosticEvaluator *>(this);
22222231
auto nonTransferrableValue =
22232232
info->getValueMap().getRepresentative(transferredVal);
@@ -2236,7 +2245,7 @@ struct DiagnosticEvaluator final
22362245
<< " Rep: "
22372246
<< *info->getValueMap().getRepresentative(inoutSendingVal)
22382247
<< " Dynamic Isolation Region: ";
2239-
isolationRegionInfo.printForDiagnostics(llvm::dbgs());
2248+
isolationRegionInfo.printForOneLineLogging(llvm::dbgs());
22402249
llvm::dbgs() << '\n');
22412250
auto *self = const_cast<DiagnosticEvaluator *>(this);
22422251
auto nonTransferrableValue =
@@ -2257,7 +2266,7 @@ struct DiagnosticEvaluator final
22572266
<< " Rep: "
22582267
<< *info->getValueMap().getRepresentative(transferredVal)
22592268
<< " Dynamic Isolation Region: ";
2260-
isolationRegionInfo.printForDiagnostics(llvm::dbgs());
2269+
isolationRegionInfo.printForOneLineLogging(llvm::dbgs());
22612270
llvm::dbgs() << '\n');
22622271

22632272
auto *self = const_cast<DiagnosticEvaluator *>(this);

0 commit comments

Comments
 (0)