[CoroutineAccessors] Rewrite allocs in LBA.

When replacing a `begin_apply` with an allocation, replace uses of the
old allocation with uses of the new.
This commit is contained in:
Nate Chandler
2024-11-19 12:51:33 -08:00
parent 11e3ea55c6
commit 79c62dd5a0
2 changed files with 59 additions and 0 deletions

View File

@@ -2590,6 +2590,10 @@ void LoadableByAddress::recreateSingleApply(
// Use the new token result.
oldApply->getTokenResult()->replaceAllUsesWith(newApply->getTokenResult());
if (auto *allocation = oldApply->getCalleeAllocationResult()) {
allocation->replaceAllUsesWith(newApply->getCalleeAllocationResult());
}
// Rewrite all the yields.
auto oldYields = oldApply->getOrigCalleeType()->getYields();
auto oldYieldedValues = oldApply->getYieldedValues();