[PATCH] D103593: [Coroutine] Sink lifetime markers after switch of suspend blocks to avoid disturbing must tail calls

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 8 18:41:13 PDT 2021


ChuanqiXu added inline comments.


================
Comment at: llvm/test/Transforms/Coroutines/coro-debug.ll:22
   %3 = call i8 @llvm.coro.suspend(token none, i1 false), !dbg !17
-  %conv = sext i8 %3 to i32, !dbg !17
   %late_local = alloca i32, align 4
----------------
lxfind wrote:
> This seems very common in our test cases, are you sure this kind of conversion can never happen?
Probably yes. Since the code emitted in the clang frontend is:
```
%suspendResult = call i8 @llvm.coro.suspend()
%switch i8 % suspendResult, label ...
```

To my knowledge, it's hard to believe that there would be conversion from i8 to i32 in the middle end. So I think this code pattern is only live in the test cases.

The things that I worried about is that the guard codes would restrict the semantics of Coroutine APIs. Since in the documentation, it didn't say we must use a switch follow the `llvm.coro.suspend`. I wonder if the restriction is too hard. How do you guys think about it? @rjmccall and @lxfind .


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103593/new/

https://reviews.llvm.org/D103593



More information about the llvm-commits mailing list