[all-commits] [llvm/llvm-project] c2cb09: [Coroutine] Move all used local allocas to the .re...
Xun Li via All-commits
all-commits at lists.llvm.org
Mon Nov 9 17:25:10 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: c2cb093d9b968f50ded99680a841d46120a114ef
https://github.com/llvm/llvm-project/commit/c2cb093d9b968f50ded99680a841d46120a114ef
Author: Xun Li <xun at fb.com>
Date: 2020-11-09 (Mon, 09 Nov 2020)
Changed paths:
M llvm/lib/Transforms/Coroutines/CoroSplit.cpp
A llvm/test/Transforms/Coroutines/coro-alloca-05.ll
Log Message:
-----------
[Coroutine] Move all used local allocas to the .resume function
Prior to D89768, any alloca that's used after suspension points will be put on to the coroutine frame, and hence they will always be reloaded in the resume function.
However D89768 introduced a more precise way to determine whether an alloca should live on the frame. Allocas that are only used within one suspension region (hence does not need to live across suspension points) will not be put on the frame. They will remain local to the resume function.
When creating the new entry for the .resume function, the existing logic only moved all the allocas from the old entry to the new entry. This covers every alloca from the old entry. However allocas that's defined afer coro.begin are put into a separate basic block during CoroSplit (the PostSpill basic block). We need to make sure these allocas are moved to the new entry as well if they are used.
This patch walks through all allocas, and check if they are still used but are not reachable from the new entry, if so, we move them to the new entry.
Differential Revision: https://reviews.llvm.org/D90977
More information about the All-commits
mailing list