llvm-project
fc4aad7b - [Clang][Coroutines] Don't emit fake uses for coroutine parameters (#194690)

Commit
7 days ago
[Clang][Coroutines] Don't emit fake uses for coroutine parameters (#194690) Fixes issue: https://github.com/llvm/llvm-project/issues/192351 The combination of coroutines with -fextend-variable-liveness has resulted in use-after-free, caused by the fact that we insert fake uses of coroutine parameters at the end of the coroutine. While this is fine for normal functions, in coroutines these variables are stored in the coroutine frame, which is freed before the end of the function; this results in us loading from the deleted frame. This patch fixes this by no longer emitting fake uses for most coroutine parameters. Since coroutine parameters will be saved back to the frame when we suspend, and currently may not be optimized out, fake uses are not needed in this case, and so by not emitting them we avoid dealing with the complexity of updating fake uses in the CoroSplit pass. The exception to this is 'this', which is not saved to the frame. (cherry picked from commit efb01c1bf558eaaf8ec64e1a54110584e827f21b)
Author
Committer
Parents
Loading