[AddressLowering] Handle builtins for resumes.

The builtins for resuming UnsafeContinuations traffic in generic values
and must be rewritten to use addresses instead of values.
This commit is contained in:
Nate Chandler
2022-12-07 12:06:03 -08:00
parent 9774e98202
commit b6e6c20865
2 changed files with 50 additions and 0 deletions

View File

@@ -2930,6 +2930,16 @@ protected:
void visitBuiltinInst(BuiltinInst *bi) {
switch (bi->getBuiltinKind().value_or(BuiltinValueKind::None)) {
case BuiltinValueKind::ResumeNonThrowingContinuationReturning: {
SILValue opAddr = addrMat.materializeAddress(use->get());
bi->setOperand(1, opAddr);
break;
}
case BuiltinValueKind::ResumeThrowingContinuationReturning: {
SILValue opAddr = addrMat.materializeAddress(use->get());
bi->setOperand(1, opAddr);
break;
}
case BuiltinValueKind::Copy: {
SILValue opAddr = addrMat.materializeAddress(use->get());
bi->setOperand(0, opAddr);