[llvm-dev] RFC: Coroutine Optimization Passes

Dean Michael Berris via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 15 07:58:31 PDT 2016


> On 16 Jul 2016, at 00:17, Gor Nishanov via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi Vadim
> 
>> Can't this transform be performed entirely in the front-end?
> 
> Absolutely it can. But, such a coroutine becomes unoptimizable. Once
> split, we lose SSA-form, don't see the control flow clearly. The
> wonderful property of the proposed approach is that a coroutine stays
> intact looking like a normal function for as long as possible. We let
> the optimizer to clean it up, doing constant propagation, constant
> folding, CSE, dead code elimination, heap allocation elision, etc.
> 
> The frontend does not have the tools to make coroutines efficient.
> 

Another possible advantage to seeing this in LLVM IR is so that the coroutines could be used in implementing other features in other languages that end up using the LLVM infrastructure without exposing coroutines in the higher level language. This also has implications for systems that JIT using LLVM IR and would like to get the coroutine functionality even in the JIT'ed code.

Cheers


More information about the llvm-dev mailing list