@@ -303,7 +303,7 @@ The LLVM IR for this coroutine looks like this:
303303 call void @free(ptr %mem)
304304 br label %suspend
305305 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)
307307 ret ptr %hdl
308308 }
309309
@@ -637,7 +637,7 @@ store the current value produced by a coroutine.
637637 call void @free(ptr %mem)
638638 br label %suspend
639639 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)
641641 ret ptr %hdl
642642 }
643643
@@ -806,7 +806,7 @@ The LLVM IR for a coroutine using a Coroutine with a custom ABI looks like:
806806 call void @free(ptr %mem)
807807 br label %suspend
808808 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)
810810 ret ptr %hdl
811811 }
812812
@@ -1444,7 +1444,7 @@ A frontend should emit function attribute `presplitcoroutine` for the coroutine.
14441444^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14451445::
14461446
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>)
14481448
14491449Overview:
14501450"""""""""
@@ -1502,9 +1502,8 @@ For landingpad based exception model, it is expected that frontend uses the
15021502.. code-block :: llvm
15031503
15041504 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
15081507
15091508 cleanup.cont:
15101509 ; rest of the cleanup
@@ -1516,10 +1515,10 @@ For landingpad based exception model, it is expected that frontend uses the
15161515 %lpad.val29 = insertvalue { ptr, i32 } %lpad.val, i32 %sel, 1
15171516 resume { ptr, i32 } %lpad.val29
15181517
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 .
15231522
15241523For Windows Exception handling model, a frontend should attach a funclet bundle
15251524referring to an enclosing cleanuppad as follows:
@@ -1528,7 +1527,7 @@ referring to an enclosing cleanuppad as follows:
15281527
15291528 ehcleanup:
15301529 %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) ]
15321531 cleanupret from %tok unwind label %RestOfTheCleanup
15331532
15341533 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:
15931592
15941593 cleanup:
15951594 %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)
15971596 unreachable
15981597
15991598 ...
@@ -1605,7 +1604,7 @@ The number of arguments must match the return type of the continuation function:
16051604^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16061605::
16071606
1608- declare void @llvm.coro.end.async(ptr <handle>, i1 <unwind>, ...)
1607+ declare i1 @llvm.coro.end.async(ptr <handle>, i1 <unwind>, ...)
16091608
16101609Overview:
16111610"""""""""
@@ -1636,10 +1635,10 @@ the function call.
16361635
16371636.. code-block :: llvm
16381637
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)
16431642 unreachable
16441643
16451644 .. _coro.suspend :
@@ -2118,30 +2117,6 @@ Example:
21182117 %hdl.result = ... ; get address of returned coroutine handle
21192118 ret ptr %hdl.result
21202119
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-
21452120 Coroutine Transformation Passes
21462121===============================
21472122CoroEarly
0 commit comments