[llvm] [Coroutines] Only rematerialize when operands are available after the suspend (PR #209195)

Christian Ulmann via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 22:50:25 PDT 2026


Dinistro wrote:

Thanks for taking a look.

> An instinct concern is about the compilation times. Did you test the compilation time change for this patch?

I did not do so yet. How do you suggest to facilitate this? Do we have some established benchmark that I could run easily?

> Another thought is about the style, previously we did simple rematerialization to reduce the pressure of coroutine frame.

That might have been the idea, but there are cases where the size of the frame is being increased due to this. This patch is attempting to address this by only considering rematerialization when the number of frame fields does not get increased. 

> But now we use the information of coroutine frame to make more rematerialization. This is some loop in the abstract concepts. Just some random thought: can we make this optimization after generating the spills? Then we don't need to call methods to decide if something is crossing suspend points or not. We just recovering some spills. WDYT?

I don't think that we can do this post-spilling, as we want to reduce the number of frame fields to a minimum. If we already introduce the spills, then the frame field was already allocated.

Note that I added an additional test case which shows a clear defect of today's implementation. I hope this helps in clarifying the intent of this change a bit better.




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


More information about the llvm-commits mailing list