Skip to content

Commit 28596aa

Browse files
committed
Handle cases that coro.promise may be inlined
1 parent 2908155 commit 28596aa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Transforms/Coroutines/Coroutines.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,10 @@ void coro::Shape::cleanCoroutine(
495495
CoroSave->eraseFromParent();
496496
UnusedCoroSaves.clear();
497497

498+
auto *AI = getPromiseAlloca();
498499
for (auto *PI : CoroPromises) {
499-
PI->replaceAllUsesWith(getPromiseAlloca());
500+
PI->replaceAllUsesWith(PI->isFromPromise() ? cast<Value>(CoroBegin)
501+
: cast<Value>(AI));
500502
PI->eraseFromParent();
501503
}
502504
}

0 commit comments

Comments
 (0)