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

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 09:13:18 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
----------------
mtrofin wrote:

In your example, if they derive some result based on the initial set of instrumentations they insert, they may produce reports that say "incomplete coverage" (for example). Some level of knowledge ends up being passed down to someone - maybe the user, maybe the analyzer of the data.

But I get the idea that maybe the domain is OK with loss of instructions, so the assert could be annoying. Dunno, only saw the example where it wasn't.

How about an ORE? The output could technically be usable by a tool in a fictitious coverage case, it offers more focused observability than dumping IR before/after in a debugging case, and it serves as self-documentation in the pass itself that "ya, we're dropping stuff here. It's intentional". The ORE wouldn't need to be too complex, maybe if we detect non-debug (and maybe also exclude lifetime) instructions, ORE out. WDYT?

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


More information about the llvm-commits mailing list