[cfe-dev] Compile .ll file with coroutines intrinsics

Mehdi AMINI via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 2 22:25:00 PDT 2021

Hi all,

I'm trying to figure out how to use clang to compile some piece of IR in a
.ll generated with coroutines.

I tried to use the `-fcoroutines-ts`, but it isn't even forwarded by the
driver to CC1. And even if I use -Xclang to forward it manually it is then
ignored because LLVM IR input is shortcut
by CompilerInvocation::ParseLangArgs.

What's the best way here? I could add support
in CompilerInvocation::ParseLangArgs:

@@ -3547,6 +3546,9 @@ bool CompilerInvocation::ParseLangArgs(L
                         Diags, Opts.Sanitize);

+    // Allows to use -fcoroutine-ts with IR input.
+    Opts.Coroutines = Args.hasArg(OPT_fcoroutines_ts);
     return Diags.getNumErrors() == NumErrorsBefore;

But I still need to figure out how to have the driver propagate the option
to cc1, any pointer?
Is it expected to silently discard it here by the way? It is
quite surprising to me).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210702/9bfa557b/attachment.html>

More information about the cfe-dev mailing list