Skip to content

Commit fff1c5d

Browse files
authored
Merge pull request #66685 from meg-gupta/interiorpointerupdate
Update operand ownership of some concurrency instructions
2 parents b63a106 + acba067 commit fff1c5d

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

lib/SIL/IR/OperandOwnership.cpp

+12-20
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,8 @@ OPERAND_OWNERSHIP(ForwardingConsume, Throw)
308308
OPERAND_OWNERSHIP(InteriorPointer, RefElementAddr)
309309
OPERAND_OWNERSHIP(InteriorPointer, RefTailAddr)
310310
OPERAND_OWNERSHIP(InteriorPointer, OpenExistentialBox)
311-
// FIXME: HopToExecutorInst should be an instantaneous use.
312-
OPERAND_OWNERSHIP(InteriorPointer, HopToExecutor)
313-
OPERAND_OWNERSHIP(InteriorPointer, ExtractExecutor)
311+
OPERAND_OWNERSHIP(InstantaneousUse, HopToExecutor)
312+
OPERAND_OWNERSHIP(PointerEscape, ExtractExecutor)
314313

315314
// Instructions that propagate a value within a borrow scope.
316315
OPERAND_OWNERSHIP(GuaranteedForwarding, TupleExtract)
@@ -894,12 +893,8 @@ OperandOwnershipBuiltinClassifier::visitCreateAsyncTask(BuiltinInst *bi,
894893
// The function operand is consumed by the new task.
895894
if (&op == &bi->getOperandRef(PARAMETER_INDEX_CREATE_ASYNC_TASK_FUTURE_FUNCTION))
896895
return OperandOwnership::DestroyingConsume;
897-
898-
// FIXME: These are considered InteriorPointer because they may propagate a
899-
// pointer into a borrowed values. If they do not propagate an interior pointer,
900-
// then they should be InstantaneousUse instead and should not require a
901-
// guaranteed value.
902-
return OperandOwnership::InteriorPointer;
896+
897+
return OperandOwnership::InstantaneousUse;
903898
}
904899

905900
OperandOwnership
@@ -908,12 +903,8 @@ OperandOwnershipBuiltinClassifier::visitCreateAsyncTaskInGroup(BuiltinInst *bi,
908903
// The function operand is consumed by the new task.
909904
if (&op == &bi->getOperandRef(PARAMETER_INDEX_CREATE_ASYNC_TASK_GROUP_FUTURE_FUNCTION))
910905
return OperandOwnership::DestroyingConsume;
911-
912-
// FIXME: These are considered InteriorPointer because they may propagate a
913-
// pointer into a borrowed values. If they do not propagate an interior pointer,
914-
// then they should be InstantaneousUse instead and should not require a
915-
// guaranteed value.
916-
return OperandOwnership::InteriorPointer;
906+
907+
return OperandOwnership::InstantaneousUse;
917908
}
918909

919910
OperandOwnership OperandOwnershipBuiltinClassifier::
@@ -945,12 +936,13 @@ visitResumeThrowingContinuationThrowing(BuiltinInst *bi, StringRef attr) {
945936

946937
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, TaskRunInline)
947938

948-
BUILTIN_OPERAND_OWNERSHIP(InteriorPointer, CancelAsyncTask)
949-
BUILTIN_OPERAND_OWNERSHIP(InteriorPointer, InitializeDefaultActor)
950-
BUILTIN_OPERAND_OWNERSHIP(InteriorPointer, DestroyDefaultActor)
939+
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, CancelAsyncTask)
940+
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, InitializeDefaultActor)
941+
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, DestroyDefaultActor)
951942

952-
BUILTIN_OPERAND_OWNERSHIP(InteriorPointer, InitializeDistributedRemoteActor)
953-
BUILTIN_OPERAND_OWNERSHIP(InteriorPointer, InitializeNonDefaultDistributedActor)
943+
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse, InitializeDistributedRemoteActor)
944+
BUILTIN_OPERAND_OWNERSHIP(InstantaneousUse,
945+
InitializeNonDefaultDistributedActor)
954946

955947
BUILTIN_OPERAND_OWNERSHIP(PointerEscape, AutoDiffAllocateSubcontext)
956948
BUILTIN_OPERAND_OWNERSHIP(PointerEscape, AutoDiffProjectTopLevelSubcontext)

lib/SIL/Verifier/SILVerifier.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,13 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
13031303
"Operand constraint should never have an unowned preferred "
13041304
"kind since guaranteed and owned values can always be passed "
13051305
"in unowned positions");
1306+
1307+
require(operand.getOperandOwnership() !=
1308+
OperandOwnership::InteriorPointer ||
1309+
InteriorPointerOperandKind::get(&operand) !=
1310+
InteriorPointerOperandKind::Invalid,
1311+
"All operands with InteriorPointer operand ownership should be "
1312+
"added to the InteriorPointerOperand utility");
13061313
}
13071314
}
13081315

0 commit comments

Comments
 (0)