[coroutines][PR40979] Ignore unreachable uses across suspend points
authorBrian Gesiak <modocache@gmail.com>
Mon, 11 Mar 2019 18:31:28 +0000 (18:31 +0000)
committerBrian Gesiak <modocache@gmail.com>
Mon, 11 Mar 2019 18:31:28 +0000 (18:31 +0000)
commitd7b68132d8f2e6d710340abc75cded5dcbec3487
treeaa5947dea0acb0285099c147b0bebe79ab361041
parent76d66123b27d7e49fa15a347c006ef9454069614
[coroutines][PR40979] Ignore unreachable uses across suspend points

Summary:
Depends on https://reviews.llvm.org/D59069.

https://bugs.llvm.org/show_bug.cgi?id=40979 describes a bug in which the
-coro-split pass would assert that a use was across a suspend point from
a definition. Normally this would mean that a value would "spill" across
a suspend point and thus need to be stored in the coroutine frame. However,
in this case the use was unreachable, and so it would not be necessary
to store the definition on the frame.

To prevent the assert, simply remove unreachable basic blocks from a
coroutine function before computing spills. This avoids the assert
reported in PR40979.

Reviewers: GorNishanov, tks2103

Reviewed By: GorNishanov

Subscribers: EricWF, jdoerfert, llvm-commits, lewissbaker

Tags: #llvm

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

llvm-svn: 355852
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/test/Transforms/Coroutines/coro-frame-unreachable.ll [new file with mode: 0644]