[Coroutines] Part12: Handle alloca address-taken
authorGor Nishanov <GorNishanov@gmail.com>
Mon, 5 Sep 2016 23:45:45 +0000 (23:45 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Mon, 5 Sep 2016 23:45:45 +0000 (23:45 +0000)
commitccabaca2737b54dea1e5020f76b16991733de45e
tree3b9f4f0ad9689c7687e5a1167a97418069769323
parenteea2ef7862e0be7368a74b142d5d87f700b02a8d
[Coroutines] Part12: Handle alloca address-taken

Summary:
Move early uses of spilled variables after CoroBegin.

For example, if a parameter had address taken, we may end up with the code
like:
        define @f(i32 %n) {
          %n.addr = alloca i32
          store %n, %n.addr
          ...
          call @coro.begin

This patch fixes the problem by moving uses of spilled variables after CoroBegin.

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 280678
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/test/Transforms/Coroutines/ArgAddr.ll [new file with mode: 0644]