Skip to content

Commit d94e4c4

Browse files
committed
[region-isolation] Using the print method from the previous commit, ensure that we dump out SentNeverSendable, InOutSendingNotDisconnectedAtExit, AssignNeverSendableIntoSendingResult earlier when we initially detect them.
This just improves the ability to quickly triage bugs in SendNonSendable. It used to be this way, but in the process of doing some refactoring, I moved the logging too late by mistake.
1 parent d33f819 commit d94e4c4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/SILOptimizer/Mandatory/SendNonSendable.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2316,10 +2316,8 @@ struct DiagnosticEvaluator final
23162316

23172317
void handleLocalUseAfterSend(LocalUseAfterSendError error) const {
23182318
const auto &partitionOp = *error.op;
2319-
Element sentElement = error.sentElement;
2320-
Operand *sendingOp = error.sendingOp;
23212319

2322-
auto &operandState = operandToStateMap.get(sendingOp);
2320+
auto &operandState = operandToStateMap.get(error.sendingOp);
23232321
// Ignore this if we have a gep like instruction that is returning a
23242322
// sendable type and sendingOp was not set with closure
23252323
// capture.
@@ -2337,7 +2335,7 @@ struct DiagnosticEvaluator final
23372335

23382336
REGIONBASEDISOLATION_LOG(error.print(llvm::dbgs(), info->getValueMap()));
23392337
sendingOpToRequireInstMultiMap.insert(
2340-
sendingOp, RequireInst::forUseAfterSend(partitionOp.getSourceInst()));
2338+
error.sendingOp, RequireInst::forUseAfterSend(partitionOp.getSourceInst()));
23412339
}
23422340

23432341
void handleInOutSendingNotInitializedAtExitError(
@@ -2372,6 +2370,11 @@ struct DiagnosticEvaluator final
23722370
case PartitionOpError::InOutSendingNotDisconnectedAtExit:
23732371
case PartitionOpError::SentNeverSendable:
23742372
case PartitionOpError::AssignNeverSendableIntoSendingResult:
2373+
// We are going to process these later... but dump so we can see that we
2374+
// handled an error here. The rest of the explicit handlers will dump as
2375+
// appropriate if they want to emit an error here (some will squelch the
2376+
// error).
2377+
REGIONBASEDISOLATION_LOG(error.print(llvm::dbgs(), info->getValueMap()));
23752378
foundVerbatimErrors.emplace_back(error);
23762379
return;
23772380
case PartitionOpError::InOutSendingNotInitializedAtExit: {

0 commit comments

Comments
 (0)