@@ -303,7 +303,7 @@ The LLVM IR for this coroutine looks like this:
303
303
call void @free(ptr %mem)
304
304
br label %suspend
305
305
suspend:
306
- call void @llvm.coro.end(ptr %hdl, i1 false, token none)
306
+ %unused = call i1 @llvm.coro.end(ptr %hdl, i1 false, token none)
307
307
ret ptr %hdl
308
308
}
309
309
@@ -637,7 +637,7 @@ store the current value produced by a coroutine.
637
637
call void @free(ptr %mem)
638
638
br label %suspend
639
639
suspend:
640
- call void @llvm.coro.end(ptr %hdl, i1 false, token none)
640
+ %unused = call i1 @llvm.coro.end(ptr %hdl, i1 false, token none)
641
641
ret ptr %hdl
642
642
}
643
643
@@ -806,7 +806,7 @@ The LLVM IR for a coroutine using a Coroutine with a custom ABI looks like:
806
806
call void @free(ptr %mem)
807
807
br label %suspend
808
808
suspend:
809
- call void @llvm.coro.end(ptr %hdl, i1 false, token none)
809
+ %unused = call i1 @llvm.coro.end(ptr %hdl, i1 false, token none)
810
810
ret ptr %hdl
811
811
}
812
812
@@ -1444,7 +1444,7 @@ A frontend should emit function attribute `presplitcoroutine` for the coroutine.
1444
1444
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1445
1445
::
1446
1446
1447
- declare void @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>)
1447
+ declare i1 @llvm.coro.end(ptr <handle>, i1 <unwind>, token <result.token>)
1448
1448
1449
1449
Overview:
1450
1450
"""""""""
@@ -1502,9 +1502,8 @@ For landingpad based exception model, it is expected that frontend uses the
1502
1502
.. code-block :: llvm
1503
1503
1504
1504
ehcleanup:
1505
- call void @llvm.coro.end(ptr null, i1 true, token none)
1506
- %InRamp = call i1 @llvm.coro.is_in_ramp()
1507
- br i1 %InRamp, label %cleanup.cont, label %eh.resume
1505
+ %InResumePart = call i1 @llvm.coro.end(ptr null, i1 true, token none)
1506
+ br i1 %InResumePart, label %eh.resume, label %cleanup.cont
1508
1507
1509
1508
cleanup.cont:
1510
1509
; rest of the cleanup
@@ -1516,10 +1515,10 @@ For landingpad based exception model, it is expected that frontend uses the
1516
1515
%lpad.val29 = insertvalue { ptr, i32 } %lpad.val, i32 %sel, 1
1517
1516
resume { ptr, i32 } %lpad.val29
1518
1517
1519
- The `CoroSpit ` pass replaces `coro.is_in_ramp ` with ``True `` in the ramp functions,
1520
- thus allowing to proceed to the rest of the cleanup code that is only needed during
1521
- initial invocation of the coroutine. Otherwise, it is replaced with ``False ``,
1522
- thus leading to immediate unwind to the caller .
1518
+ The `CoroSpit ` pass replaces `coro.end ` with ``True `` in the resume functions,
1519
+ thus leading to immediate unwind to the caller, whereas in start function it
1520
+ is replaced with ``False ``, thus allowing to proceed to the rest of the cleanup
1521
+ code that is only needed during initial invocation of the coroutine .
1523
1522
1524
1523
For Windows Exception handling model, a frontend should attach a funclet bundle
1525
1524
referring to an enclosing cleanuppad as follows:
@@ -1528,7 +1527,7 @@ referring to an enclosing cleanuppad as follows:
1528
1527
1529
1528
ehcleanup:
1530
1529
%tok = cleanuppad within none []
1531
- call void @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %tok) ]
1530
+ %unused = call i1 @llvm.coro.end(ptr null, i1 true, token none) [ "funclet"(token %tok) ]
1532
1531
cleanupret from %tok unwind label %RestOfTheCleanup
1533
1532
1534
1533
The `CoroSplit ` pass, if the funclet bundle is present, will insert
@@ -1593,7 +1592,7 @@ The number of arguments must match the return type of the continuation function:
1593
1592
1594
1593
cleanup:
1595
1594
%tok = call token (...) @llvm.coro.end.results(i8 %val)
1596
- call void @llvm.coro.end(ptr %hdl, i1 0, token %tok)
1595
+ call i1 @llvm.coro.end(ptr %hdl, i1 0, token %tok)
1597
1596
unreachable
1598
1597
1599
1598
...
@@ -1605,7 +1604,7 @@ The number of arguments must match the return type of the continuation function:
1605
1604
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1606
1605
::
1607
1606
1608
- declare void @llvm.coro.end.async(ptr <handle>, i1 <unwind>, ...)
1607
+ declare i1 @llvm.coro.end.async(ptr <handle>, i1 <unwind>, ...)
1609
1608
1610
1609
Overview:
1611
1610
"""""""""
@@ -1636,10 +1635,10 @@ the function call.
1636
1635
1637
1636
.. code-block :: llvm
1638
1637
1639
- call void (ptr, i1, ...) @llvm.coro.end.async(
1640
- ptr %hdl, i1 0,
1641
- ptr @must_tail_call_return,
1642
- ptr %ctxt, ptr %task, ptr %actor)
1638
+ call i1 (ptr, i1, ...) @llvm.coro.end.async(
1639
+ ptr %hdl, i1 0,
1640
+ ptr @must_tail_call_return,
1641
+ ptr %ctxt, ptr %task, ptr %actor)
1643
1642
unreachable
1644
1643
1645
1644
.. _coro.suspend :
@@ -2118,30 +2117,6 @@ Example:
2118
2117
%hdl.result = ... ; get address of returned coroutine handle
2119
2118
ret ptr %hdl.result
2120
2119
2121
- 'llvm.coro.is_in_ramp' Intrinsic
2122
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2123
- ::
2124
-
2125
- declare i1 @llvm.coro.is_in_ramp()
2126
-
2127
- Overview:
2128
- """""""""
2129
-
2130
- The '``llvm.coro.is_in_ramp ``' intrinsic returns a bool value that marks coroutine ramp
2131
- function and resume/destroy function.
2132
-
2133
- Arguments:
2134
- """"""""""
2135
-
2136
- None
2137
-
2138
- Semantics:
2139
- """"""""""
2140
-
2141
- The `CoroSpit ` pass replaces `coro.is_in_ramp ` with ``True `` ramp functions.
2142
- Otherwise, it is replaced with ``False ``, allowing the frontend to separate
2143
- ramp function and resume/destroy function.
2144
-
2145
2120
Coroutine Transformation Passes
2146
2121
===============================
2147
2122
CoroEarly
0 commit comments