[PATCH] D22603: [coroutines] Part 1 of N: Documentation

Gor Nishanov via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 08:59:17 PDT 2016


GorNishanov added a comment.

I think I was too cryptic in my repsonse to your second question. I can provide brief answers to your points now without deferring for later reviews or discussions on llvm-dev.

In https://reviews.llvm.org/D22603#492436, @dberris wrote:

>




> - Will the escape analysis figure out whether there are resources that need cleaning up once execution has flowed through resume points? Say for example, there's a local variable in the preamble that never gets touched again in the resume points -- will the analysis be able to see that there aren't references anymore in the resume points? i.e. is it possible to do just in lowering, or do you need to teach some of the other optimisations about what the final layout would be for coroutines to be able to make these kinds of optimisations?


Yes. All of the coroutine logic is fully contained in the coroutine passes. This was one of the design goals for this feature to make coroutine handling completely segregated in those passes. No other passes should care about coroutines.

The idea is that a coroutine is a normal functions with some intrinsics, it travels through the pipelines and is optimizer just like a normal function.

At the end of the IPO pipeline, we split the coroutine into state + function manipulating the state and add those functions to SCC and restart the pipeline, so that now we optimize individual functions driving the state machine.

Figuring out which objects need to go to the coroutine frame and which can stay on the stack, is done as a part of the coroutine splitting pass (where all of the meat is, other three coroutine passes are tiny and very simple)

> I don't know if these should be documented here or somewhere else (and if they're been asked before then apologies for being late to the party).





https://reviews.llvm.org/D22603





More information about the llvm-commits mailing list