CoroFrame: Put escaped variables with multiple lifetimes on coroutine frame
authorMatthias Braun <matze@braunis.de>
Fri, 16 Dec 2022 15:21:41 +0000 (07:21 -0800)
committerMatthias Braun <matze@braunis.de>
Wed, 4 Jan 2023 15:30:08 +0000 (07:30 -0800)
commitae7bf2b80b9bc6ff1adca0beed03f545fd40a35b
tree3b37e7b27640fe7451b7cb51d3219c4a3c546aea
parent2f79f5438cd6f4fa0fdc32458911c2d163f917c0
CoroFrame: Put escaped variables with multiple lifetimes on coroutine frame

The llvm.lifetime.start intrinsic guarantees that the address for a
given alloca is always the same. So variables with escaped addresses
reaching reaching a lifetime start/end block before and after a suspend
must be placed onto the coroutine frame even if the variable itself
is not alive across the suspend point.

This computes a new `LoopKill` flag in the suspend crossing data flow
anaysis to catch the case where a lifetime marker can reach itself
via suspend-crossing path.

This fixes https://llvm.org/PR52501

Differential Revision: https://reviews.llvm.org/D140231
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/test/Transforms/Coroutines/coro-alloca-loop-carried-address.ll [new file with mode: 0644]