Skip to content

Commit fe25ae6

Browse files
authored
[SUA][Coroutines] Change LLVM's Coroutine lowering to allow for and use extra hash parameter to llvm.coro.id.retcon.once and llvm.coro.id.retcon (#10015)
[SUA][Coroutines] Change LLVM's Coroutine lowering to allow for and use extra hash parameter to llvm.coro.id.retcon.once and llvm.coro.id.retcon Change the signatures of llvm.coro.id.retcon.once and llvm.coro.id.retcon to pass a hash parameter as a variable argument. This change will allow IRGen to pass the new runtime function swift_coroFrameAlloc (which calls the typed allocator if TMO is enabled) along with a type hash to these two intrinsics. rdar://141236876
1 parent 9ad8afc commit fe25ae6

21 files changed

+185
-51
lines changed

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,11 +1725,11 @@ def int_coro_id : DefaultAttrsIntrinsic<[llvm_token_ty],
17251725
NoCapture<ArgIndex<2>>]>;
17261726
def int_coro_id_retcon : Intrinsic<[llvm_token_ty],
17271727
[llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty,
1728-
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty],
1728+
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_vararg_ty],
17291729
[]>;
17301730
def int_coro_id_retcon_once : Intrinsic<[llvm_token_ty],
17311731
[llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty,
1732-
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty],
1732+
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_vararg_ty],
17331733
[]>;
17341734
def int_coro_alloc : Intrinsic<[llvm_i1_ty], [llvm_token_ty], []>;
17351735
def int_coro_id_async : Intrinsic<[llvm_token_ty],

llvm/include/llvm/Transforms/Coroutines/CoroInstr.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class CoroIdInst : public AnyCoroIdInst {
234234
/// This represents either the llvm.coro.id.retcon or
235235
/// llvm.coro.id.retcon.once instruction.
236236
class AnyCoroIdRetconInst : public AnyCoroIdInst {
237-
enum { SizeArg, AlignArg, StorageArg, PrototypeArg, AllocArg, DeallocArg };
237+
enum { SizeArg, AlignArg, StorageArg, PrototypeArg, AllocArg, DeallocArg, TypeIdArg };
238238

239239
public:
240240
void checkWellFormed() const;
@@ -266,6 +266,19 @@ class AnyCoroIdRetconInst : public AnyCoroIdInst {
266266
return cast<Function>(getArgOperand(DeallocArg)->stripPointerCasts());
267267
}
268268

269+
/// Return the TypeId to be used for allocating typed memory
270+
ConstantInt *getTypeId() const {
271+
if (arg_size() <= TypeIdArg)
272+
return nullptr;
273+
assert(hasTypeId() && "Invalid number of arguments");
274+
return cast<ConstantInt>(getArgOperand(TypeIdArg));
275+
}
276+
277+
/// Return true if TypeId is present in the list of arguments, false otherwise
278+
bool hasTypeId() const {
279+
return arg_size() == TypeIdArg + 1;
280+
}
281+
269282
// Methods to support type inquiry through isa, cast, and dyn_cast:
270283
static bool classof(const IntrinsicInst *I) {
271284
auto ID = I->getIntrinsicID();

llvm/include/llvm/Transforms/Coroutines/CoroShape.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct Shape {
129129
Function *Dealloc;
130130
BasicBlock *ReturnBlock;
131131
bool IsFrameInlineInStorage;
132+
ConstantInt* TypeId;
132133
};
133134

134135
struct AsyncLoweringStorage {

llvm/lib/Transforms/Coroutines/Coroutines.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ void coro::Shape::analyze(Function &F,
337337
RetconLowering.Dealloc = ContinuationId->getDeallocFunction();
338338
RetconLowering.ReturnBlock = nullptr;
339339
RetconLowering.IsFrameInlineInStorage = false;
340+
RetconLowering.TypeId = ContinuationId->getTypeId();
340341
break;
341342
}
342343
default:
@@ -513,7 +514,12 @@ Value *coro::Shape::emitAlloc(IRBuilder<> &Builder, Value *Size,
513514
Size = Builder.CreateIntCast(Size,
514515
Alloc->getFunctionType()->getParamType(0),
515516
/*is signed*/ false);
516-
auto *Call = Builder.CreateCall(Alloc, Size);
517+
ConstantInt* TypeId = RetconLowering.TypeId;
518+
CallInst *Call;
519+
if (TypeId == nullptr)
520+
Call = Builder.CreateCall(Alloc, Size);
521+
else
522+
Call = Builder.CreateCall(Alloc, {Size, TypeId});
517523
propagateCallAttrsFromCallee(Call, Alloc);
518524
addCallToCallGraph(CG, Call, Alloc);
519525
return Call;
@@ -606,9 +612,14 @@ static void checkWFAlloc(const Instruction *I, Value *V) {
606612
if (!FT->getReturnType()->isPointerTy())
607613
fail(I, "llvm.coro.* allocator must return a pointer", F);
608614

609-
if (FT->getNumParams() != 1 ||
610-
!FT->getParamType(0)->isIntegerTy())
611-
fail(I, "llvm.coro.* allocator must take integer as only param", F);
615+
if (FT->getNumParams() > 2 || FT->getNumParams() == 0)
616+
fail(I, "llvm.coro.* allocator must take either one or two params", F);
617+
618+
if (FT->getNumParams() == 1 && !FT->getParamType(0)->isIntegerTy())
619+
fail(I, "llvm.coro.* allocator must take integer as its first param", F);
620+
621+
if (FT->getNumParams() == 2 && !FT->getParamType(1)->isIntegerTy())
622+
fail(I, "llvm.coro.* allocator must take uint64_t as its second param", F);
612623
}
613624

614625
/// Check that the given value is a well-formed deallocator.

llvm/test/Transforms/Coroutines/coro-retcon-alloca-opaque-ptr.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ define {ptr, ptr, i32} @f(ptr %buffer, i32 %n, { i32 } %dummy) {
1717
; CHECK-NEXT: ret { ptr, ptr, i32 } [[TMP2]]
1818
;
1919
entry:
20-
%id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_f, ptr @allocate, ptr @deallocate)
20+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_f, ptr @allocate, ptr @deallocate)
2121
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
2222
br label %loop
2323

@@ -51,7 +51,7 @@ define {ptr, i32} @g(ptr %buffer, i32 %n) {
5151
; CHECK-NEXT: ret { ptr, i32 } [[TMP2]]
5252
;
5353
entry:
54-
%id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_g, ptr @allocate, ptr @deallocate)
54+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_g, ptr @allocate, ptr @deallocate)
5555
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
5656
br label %loop
5757

@@ -73,7 +73,7 @@ cleanup:
7373
unreachable
7474
}
7575

76-
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr)
76+
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr, ...)
7777
declare ptr @llvm.coro.begin(token, ptr)
7878
declare i1 @llvm.coro.suspend.retcon.i1(...)
7979
declare void @llvm.coro.suspend.retcon.isVoid(...)

llvm/test/Transforms/Coroutines/coro-retcon-alloca.ll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ define {ptr, ptr, i32} @f(ptr %buffer, i32 %n) {
1616
; CHECK-NEXT: ret { ptr, ptr, i32 } [[TMP2]]
1717
;
1818
entry:
19-
%id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_f, ptr @allocate, ptr @deallocate)
19+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_f, ptr @allocate, ptr @deallocate)
2020
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
2121
br label %loop
2222

@@ -51,7 +51,7 @@ define {ptr, i32} @g(ptr %buffer, i32 %n) {
5151
; CHECK-NEXT: ret { ptr, i32 } [[TMP2]]
5252
;
5353
entry:
54-
%id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_g, ptr @allocate, ptr @deallocate)
54+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_g, ptr @allocate, ptr @deallocate)
5555
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
5656
br label %loop
5757

@@ -84,7 +84,7 @@ define {ptr, i32} @h(ptr %buffer, i32 %n) {
8484
; CHECK-NEXT: ret { ptr, i32 } [[TMP0]]
8585
;
8686
entry:
87-
%id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_h, ptr @allocate, ptr @deallocate)
87+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_h, ptr @allocate, ptr @deallocate)
8888
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
8989
br label %loop
9090

@@ -117,7 +117,7 @@ define {ptr, i32} @i(ptr %buffer, i32 %n) {
117117
; CHECK-NEXT: ret { ptr, i32 } [[TMP0]]
118118
;
119119
entry:
120-
%id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_i, ptr @allocate, ptr @deallocate)
120+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_i, ptr @allocate, ptr @deallocate)
121121
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
122122
br label %loop
123123

@@ -149,7 +149,7 @@ define {ptr, i32} @j(ptr %buffer, i32 %n) {
149149
; CHECK-NEXT: ret { ptr, i32 } [[TMP0]]
150150
;
151151
entry:
152-
%id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_j, ptr @allocate, ptr @deallocate)
152+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_j, ptr @allocate, ptr @deallocate)
153153
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
154154
br label %forward
155155

@@ -190,7 +190,7 @@ define {ptr, i32} @k(ptr %buffer, i32 %n, i1 %cond) {
190190
; CHECK-NEXT: br label [[CORO_RETURN]]
191191
;
192192
entry:
193-
%id = call token @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_g, ptr @allocate, ptr @deallocate)
193+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 1024, i32 8, ptr %buffer, ptr @prototype_g, ptr @allocate, ptr @deallocate)
194194
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
195195
br i1 %cond, label %alloca_block, label %non_alloca_block
196196

@@ -221,7 +221,7 @@ cleanup:
221221
unreachable
222222
}
223223

224-
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr)
224+
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr, ...)
225225
declare ptr @llvm.coro.begin(token, ptr)
226226
declare i1 @llvm.coro.suspend.retcon.i1(...)
227227
declare void @llvm.coro.suspend.retcon.isVoid(...)

llvm/test/Transforms/Coroutines/coro-retcon-frame.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ entry:
1818
store i64 0, ptr %proj.1, align 8
1919
store i64 0, ptr %proj.2, align 8
2020
%escape_addr = ptrtoint ptr %tmp to i64
21-
%id = call token @llvm.coro.id.retcon.once(i32 32, i32 8, ptr %buffer, ptr @prototype_f, ptr @allocate, ptr @deallocate)
21+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon.once(i32 32, i32 8, ptr %buffer, ptr @prototype_f, ptr @allocate, ptr @deallocate)
2222
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
2323
%proj.2.2 = getelementptr inbounds { i64, i64 }, ptr %tmp, i64 0, i32 1
2424
call void @init(ptr %proj.1)
@@ -49,7 +49,7 @@ end:
4949
; CHECK: resume:
5050
; CHECK: call void @use(ptr %0)
5151

52-
declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr)
52+
declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr, ...)
5353
declare ptr @llvm.coro.begin(token, ptr)
5454
declare i1 @llvm.coro.suspend.retcon.i1(...)
5555
declare i1 @llvm.coro.end(ptr, i1, token)

llvm/test/Transforms/Coroutines/coro-retcon-once-private.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ target triple = "x86_64-apple-macosx10.12.0"
77

88
define internal {ptr, i32} @f(ptr %buffer, ptr %array) {
99
entry:
10-
%id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
10+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
1111
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
1212
%load = load i32, ptr %array
1313
%load.pos = icmp sgt i32 %load, 0
@@ -34,7 +34,7 @@ cleanup:
3434
unreachable
3535
}
3636

37-
declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr)
37+
declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr, ...)
3838
declare ptr @llvm.coro.begin(token, ptr)
3939
declare i1 @llvm.coro.suspend.retcon.i1(...)
4040
declare i1 @llvm.coro.end(ptr, i1, token)

llvm/test/Transforms/Coroutines/coro-retcon-once-value.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target triple = "x86_64-apple-macosx10.12.0"
66

77
define {ptr, i32} @f(ptr %buffer, ptr %array) {
88
entry:
9-
%id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
9+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
1010
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
1111
%load = load i32, ptr %array
1212
%load.pos = icmp sgt i32 %load, 0
@@ -47,7 +47,7 @@ entry:
4747

4848
define {ptr, i32} @g(ptr %buffer, ptr %array, i32 %val) {
4949
entry:
50-
%id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype2, ptr @allocate, ptr @deallocate)
50+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype2, ptr @allocate, ptr @deallocate)
5151
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
5252
%load = load i32, ptr %array
5353
%load.pos = icmp sgt i32 %load, 0
@@ -93,7 +93,7 @@ entry:
9393
; Unfortunately, we don't seem to fully optimize this right now due
9494
; to some sort of phase-ordering thing.
9595

96-
declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr)
96+
declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr, ...)
9797
declare ptr @llvm.coro.begin(token, ptr)
9898
declare i1 @llvm.coro.suspend.retcon.i1(...)
9999
declare i1 @llvm.coro.end(ptr, i1, token)

llvm/test/Transforms/Coroutines/coro-retcon-once-value2.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target triple = "x86_64-apple-macosx10.12.0"
66
define {ptr, ptr} @f(ptr %buffer, ptr %ptr) presplitcoroutine {
77
entry:
88
%temp = alloca i32, align 4
9-
%id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
9+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
1010
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
1111
%oldvalue = load i32, ptr %ptr
1212
store i32 %oldvalue, ptr %temp
@@ -27,7 +27,7 @@ cleanup:
2727
define {ptr, ptr} @g(ptr %buffer, ptr %ptr, i8 %val) presplitcoroutine {
2828
entry:
2929
%temp = alloca i32, align 4
30-
%id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype2, ptr @allocate, ptr @deallocate)
30+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype2, ptr @allocate, ptr @deallocate)
3131
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
3232
%oldvalue = load i32, ptr %ptr
3333
store i32 %oldvalue, ptr %temp
@@ -49,7 +49,7 @@ cleanup:
4949
define {ptr, ptr} @h(ptr %buffer, ptr %ptr) presplitcoroutine {
5050
entry:
5151
%temp = alloca i32, align 4
52-
%id = call token @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype3, ptr @allocate, ptr @deallocate)
52+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon.once(i32 8, i32 8, ptr %buffer, ptr @prototype3, ptr @allocate, ptr @deallocate)
5353
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
5454
%oldvalue = load i32, ptr %ptr
5555
store i32 %oldvalue, ptr %temp
@@ -68,7 +68,7 @@ cleanup:
6868
}
6969

7070

71-
declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr)
71+
declare token @llvm.coro.id.retcon.once(i32, i32, ptr, ptr, ptr, ptr, ...)
7272
declare ptr @llvm.coro.begin(token, ptr)
7373
declare i1 @llvm.coro.suspend.retcon.i1(...)
7474
declare i1 @llvm.coro.end(ptr, i1, token)

llvm/test/Transforms/Coroutines/coro-retcon-opaque-ptr.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define ptr @f(ptr %buffer, i32 %n) {
1111
; CHECK-NEXT: ret ptr @f.resume.0
1212
;
1313
entry:
14-
%id = call token @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
14+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
1515
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
1616
br label %loop
1717

@@ -60,7 +60,7 @@ define hidden { ptr, ptr } @g(ptr %buffer, ptr %ptr) {
6060
; CHECK-NEXT: ret { ptr, ptr } [[TMP1]]
6161
;
6262
entry:
63-
%id = call token @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @g_prototype, ptr @allocate, ptr @deallocate)
63+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @g_prototype, ptr @allocate, ptr @deallocate)
6464
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
6565
br label %loop
6666

@@ -76,7 +76,7 @@ cleanup: ; preds = %loop
7676
unreachable
7777
}
7878

79-
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr)
79+
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr, ...)
8080
declare ptr @llvm.coro.begin(token, ptr)
8181
declare i1 @llvm.coro.suspend.retcon.i1(...)
8282
declare i1 @llvm.coro.end(ptr, i1, token)

llvm/test/Transforms/Coroutines/coro-retcon-remat.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
define { ptr, i32 } @f(ptr %buffer, i32 %n) {
88
entry:
9-
%id = call token @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @f_prototype, ptr @allocate, ptr @deallocate)
9+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @f_prototype, ptr @allocate, ptr @deallocate)
1010
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
1111
br label %loop
1212

@@ -35,7 +35,7 @@ cleanup:
3535
unreachable
3636
}
3737

38-
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr)
38+
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr, ...)
3939
declare ptr @llvm.coro.begin(token, ptr)
4040
declare i1 @llvm.coro.suspend.retcon.i1(...)
4141
declare i1 @llvm.coro.end(ptr, i1, token)

llvm/test/Transforms/Coroutines/coro-retcon-resume-values.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ define ptr @f(ptr %buffer, i32 %n) {
1010
; CHECK-NEXT: ret ptr @f.resume.0
1111
;
1212
entry:
13-
%id = call token @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
13+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
1414
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
1515
br label %loop
1616

@@ -63,7 +63,7 @@ entry:
6363
; Unfortunately, we don't seem to fully optimize this right now due
6464
; to some sort of phase-ordering thing.
6565

66-
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr)
66+
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr, ...)
6767
declare ptr @llvm.coro.begin(token, ptr)
6868
declare { i32, i1 } @llvm.coro.suspend.retcon.sl_i32i1s(...)
6969
declare i1 @llvm.coro.end(ptr, i1, token)

llvm/test/Transforms/Coroutines/coro-retcon-resume-values2.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
define ptr @f(ptr %buffer, i32 %n) presplitcoroutine {
55
entry:
6-
%id = call token @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
6+
%id = call token (i32, i32, ptr, ptr, ptr, ptr, ...) @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @prototype, ptr @allocate, ptr @deallocate)
77
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
88
%value0 = call i32 (...) @llvm.coro.suspend.retcon.i32()
99
%sum0 = call i32 @add(i32 %n, i32 %value0)
@@ -19,7 +19,7 @@ entry:
1919
unreachable
2020
}
2121

22-
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr)
22+
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr, ...)
2323
declare ptr @llvm.coro.begin(token, ptr)
2424
declare i32 @llvm.coro.suspend.retcon.i32(...)
2525
declare i1 @llvm.coro.end(ptr, i1, token)

0 commit comments

Comments
 (0)