CoroSplit: Fix coroutine splitting for retcon and retcon.once
authorArnold Schwaighofer <aschwaighofer@apple.com>
Tue, 2 Jun 2020 14:19:22 +0000 (07:19 -0700)
committerArnold Schwaighofer <aschwaighofer@apple.com>
Wed, 3 Jun 2020 19:10:58 +0000 (12:10 -0700)
commit2e4c5d1c483a986dbb3fc6486bdb2f0eb2adc8c8
treee9ae2498f044fcae65494efcd075a48dbacb9223
parentc2e27ac1ce3e3141f9cf0c4f6982cd56347bc323
CoroSplit: Fix coroutine splitting for retcon and retcon.once

Summary:
For retcon and retcon.once coroutines we assume that all uses of spills
can be sunk past coro.begin. This simplifies handling of instructions
that escape the address of an alloca.

The current implementation would have issues if the address of the
alloca is escaped before coro.begin. (It also has issues with casts before and
uses of those casts after the coro.begin instruction)

  %alloca_addr = alloca ...
  %escape  = ptrtoint %alloca_addr
  coro.begin
  store %escape to %alloca_addr

rdar://60272809

Subscribers: hiraditya, modocache, mgrang, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81023
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/test/Transforms/Coroutines/coro-retcon-frame.ll [new file with mode: 0644]