[clang] [llvm] [coro] Lower `llvm.coro.await.suspend.handle` to resume with tail call (PR #89751)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 09:34:31 PDT 2024


================
@@ -1056,6 +1083,25 @@ void CoroCloner::create() {
   // Set up the new entry block.
   replaceEntryBlock();
 
+  // Turn symmetric transfers into musttail calls.
+  for (CallInst *ResumeCall : Shape.SymmetricTransfers) {
+    ResumeCall = cast<CallInst>(VMap[ResumeCall]);
+    ResumeCall->setCallingConv(NewF->getCallingConv());
+    if (TTI.supportsTailCallFor(ResumeCall)) {
+      // FIXME: Could we support symmetric transfer effectively without
+      // musttail?
+      ResumeCall->setTailCallKind(CallInst::TCK_MustTail);
+    }
+
+    // Put a 'ret void' after the call, and split any remaining instructions to
----------------
zmodem wrote:

An optimization remark would be less disruptive for sure, but I'm still not sure that it's right. Even though remarks are much lower level than regular diagnostics, they're still targeted at the compiler end user. If we emit a remark that says "deleted instructions after llvm.coro.await.suspend.handle call", what would the user do with that?

https://github.com/llvm/llvm-project/pull/89751


More information about the llvm-commits mailing list