Skip to content

Commit 1143bba

Browse files
authored
Merge pull request #10041 from swiftlang/cherry-pick-tmo-retcon-lowering
[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)
2 parents fa726d8 + ed3ffe7 commit 1143bba

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
@@ -1674,11 +1674,11 @@ def int_coro_id : DefaultAttrsIntrinsic<[llvm_token_ty],
16741674
NoCapture<ArgIndex<2>>]>;
16751675
def int_coro_id_retcon : Intrinsic<[llvm_token_ty],
16761676
[llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty,
1677-
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty],
1677+
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_vararg_ty],
16781678
[]>;
16791679
def int_coro_id_retcon_once : Intrinsic<[llvm_token_ty],
16801680
[llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty,
1681-
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty],
1681+
llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_vararg_ty],
16821682
[]>;
16831683
def int_coro_alloc : Intrinsic<[llvm_i1_ty], [llvm_token_ty], []>;
16841684
def int_coro_id_async : Intrinsic<[llvm_token_ty],

llvm/lib/Transforms/Coroutines/CoroInstr.h

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

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

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

llvm/lib/Transforms/Coroutines/CoroInternal.h

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

135136
struct AsyncLoweringStorage {

llvm/lib/Transforms/Coroutines/Coroutines.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ void coro::Shape::buildFrom(Function &F) {
343343
this->RetconLowering.Dealloc = ContinuationId->getDeallocFunction();
344344
this->RetconLowering.ReturnBlock = nullptr;
345345
this->RetconLowering.IsFrameInlineInStorage = false;
346+
this->RetconLowering.TypeId = ContinuationId->getTypeId();
346347

347348
// Determine the result value types, and make sure they match up with
348349
// the values passed to the suspends.
@@ -465,7 +466,12 @@ Value *coro::Shape::emitAlloc(IRBuilder<> &Builder, Value *Size,
465466
Size = Builder.CreateIntCast(Size,
466467
Alloc->getFunctionType()->getParamType(0),
467468
/*is signed*/ false);
468-
auto *Call = Builder.CreateCall(Alloc, Size);
469+
ConstantInt* TypeId = RetconLowering.TypeId;
470+
CallInst *Call;
471+
if (TypeId == nullptr)
472+
Call = Builder.CreateCall(Alloc, Size);
473+
else
474+
Call = Builder.CreateCall(Alloc, {Size, TypeId});
469475
propagateCallAttrsFromCallee(Call, Alloc);
470476
addCallToCallGraph(CG, Call, Alloc);
471477
return Call;
@@ -558,9 +564,14 @@ static void checkWFAlloc(const Instruction *I, Value *V) {
558564
if (!FT->getReturnType()->isPointerTy())
559565
fail(I, "llvm.coro.* allocator must return a pointer", F);
560566

561-
if (FT->getNumParams() != 1 ||
562-
!FT->getParamType(0)->isIntegerTy())
563-
fail(I, "llvm.coro.* allocator must take integer as only param", F);
567+
if (FT->getNumParams() > 2 || FT->getNumParams() == 0)
568+
fail(I, "llvm.coro.* allocator must take either one or two params", F);
569+
570+
if (FT->getNumParams() == 1 && !FT->getParamType(0)->isIntegerTy())
571+
fail(I, "llvm.coro.* allocator must take integer as its first param", F);
572+
573+
if (FT->getNumParams() == 2 && !FT->getParamType(1)->isIntegerTy())
574+
fail(I, "llvm.coro.* allocator must take uint64_t as its second param", F);
564575
}
565576

566577
/// 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

@@ -58,7 +58,7 @@ define hidden { ptr, ptr } @g(ptr %buffer, ptr %ptr) {
5858
; CHECK-NEXT: ret { ptr, ptr } [[TMP1]]
5959
;
6060
entry:
61-
%id = call token @llvm.coro.id.retcon(i32 8, i32 4, ptr %buffer, ptr @g_prototype, ptr @allocate, ptr @deallocate)
61+
%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)
6262
%hdl = call ptr @llvm.coro.begin(token %id, ptr null)
6363
br label %loop
6464

@@ -74,7 +74,7 @@ cleanup: ; preds = %loop
7474
unreachable
7575
}
7676

77-
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr)
77+
declare token @llvm.coro.id.retcon(i32, i32, ptr, ptr, ptr, ptr, ...)
7878
declare ptr @llvm.coro.begin(token, ptr)
7979
declare i1 @llvm.coro.suspend.retcon.i1(...)
8080
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)