Skip to content

Commit b49a882

Browse files
committed
Add some SIL properties for get/await_async_continuation
1 parent 5dbb1a4 commit b49a882

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

lib/SIL/IR/SILInstruction.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,11 @@ bool SILInstruction::mayRelease() const {
11051105
default:
11061106
llvm_unreachable("Unhandled releasing instruction!");
11071107

1108+
case SILInstructionKind::GetAsyncContinuationInst:
1109+
case SILInstructionKind::GetAsyncContinuationAddrInst:
1110+
case SILInstructionKind::AwaitAsyncContinuationInst:
1111+
return false;
1112+
11081113
case SILInstructionKind::ApplyInst:
11091114
case SILInstructionKind::TryApplyInst:
11101115
case SILInstructionKind::BeginApplyInst:
@@ -1306,6 +1311,12 @@ bool SILInstruction::isTriviallyDuplicatable() const {
13061311
if (isa<DynamicMethodBranchInst>(this))
13071312
return false;
13081313

1314+
// Can't duplicate get/await_async_continuation.
1315+
if (isa<AwaitAsyncContinuationInst>(this) ||
1316+
isa<GetAsyncContinuationAddrInst>(this) ||
1317+
isa<GetAsyncContinuationInst>(this))
1318+
return false;
1319+
13091320
// If you add more cases here, you should also update SILLoop:canDuplicate.
13101321

13111322
return true;

lib/SIL/Utils/LoopInfo.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ bool SILLoop::canDuplicate(SILInstruction *I) const {
111111
if (isa<DynamicMethodBranchInst>(I))
112112
return false;
113113

114+
// Can't duplicate get/await_async_continuation.
115+
if (isa<AwaitAsyncContinuationInst>(I) ||
116+
isa<GetAsyncContinuationAddrInst>(I) || isa<GetAsyncContinuationInst>(I))
117+
return false;
118+
114119
// Some special cases above that aren't considered isTriviallyDuplicatable
115120
// return true early.
116121
assert(I->isTriviallyDuplicatable() &&

lib/SIL/Utils/MemAccessUtils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,10 @@ void swift::visitAccessedAddress(SILInstruction *I,
19801980
case SILInstructionKind::UnconditionalCheckedCastAddrInst:
19811981
case SILInstructionKind::UnconditionalCheckedCastValueInst:
19821982
case SILInstructionKind::ValueMetatypeInst:
1983+
// TODO: Is this correct?
1984+
case SILInstructionKind::GetAsyncContinuationInst:
1985+
case SILInstructionKind::GetAsyncContinuationAddrInst:
1986+
case SILInstructionKind::AwaitAsyncContinuationInst:
19831987
return;
19841988
}
19851989
}

0 commit comments

Comments
 (0)