This is an archive of the discontinued LLVM Phabricator instance.

[Coroutines] Part12: Handle alloca address-taken
ClosedPublic

Authored by GorNishanov on Sep 5 2016, 7:40 AM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

GorNishanov updated this revision to Diff 70330.Sep 5 2016, 7:40 AM
GorNishanov retitled this revision from to [Coroutines] Part12: Handle alloca address-taken.
GorNishanov updated this object.
GorNishanov added a reviewer: majnemer.
GorNishanov added a subscriber: llvm-commits.

replaced assert with report_fatal_error when we run into a case which we cannot handle

GorNishanov updated this revision to Diff 70347.Sep 5 2016, 1:51 PM

Revised condition:

if (DT.dominates(I, CoroBegin))

to

if (!DT.dominates(CoroBegin, I))

to cover more cases where move is needed

majnemer accepted this revision.Sep 5 2016, 2:55 PM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 5 2016, 2:55 PM
This revision was automatically updated to reflect the committed changes.