OSDN Git Service

[coroutines] Relocate instructions that maybe spilled after coro.begin
authorGor Nishanov <GorNishanov@gmail.com>
Thu, 25 May 2017 00:46:20 +0000 (00:46 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Thu, 25 May 2017 00:46:20 +0000 (00:46 +0000)
commit5d2828c385736e2db9528690895d2d28e744fe05
tree4a0cd338cc4a756bb9ed0e03bdf891c31a58cfc0
parent133fa95ca7019682c74d1c40f93d68014827a943
[coroutines] Relocate instructions that maybe spilled after coro.begin

Summary:
Frontend generates store instructions after allocas, for example:

```
define i8* @f(i64 %this) "coroutine.presplit"="1" personality i32 0 {
entry:
  %this.addr = alloca i64
  store i64 %this, i64* %this.addr
  ..
  %hdl = call i8* @llvm.coro.begin(token %id, i8* %alloc)

```
Such instructions may require spilling into coro.frame, but, coro-frame address is only available after coro.begin and thus needs to be moved after coro.begin.
The only instructions that should not be moved are the arguments of coro.begin and all of their operands.

Reviewers: GorNishanov, majnemer

Reviewed By: GorNishanov

Subscribers: llvm-commits, EricWF

Differential Revision: https://reviews.llvm.org/D33527

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303825 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Coroutines/CoroSplit.cpp
test/Transforms/Coroutines/coro-frame.ll