[all-commits] [llvm/llvm-project] b3a722: [Coroutines] Reuse storage for local variables wit...
ChuanqiXu9 via All-commits
all-commits at lists.llvm.org
Mon Sep 28 00:48:37 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: b3a722e66b75328ab5e2eb5c8572022cb083855b
https://github.com/llvm/llvm-project/commit/b3a722e66b75328ab5e2eb5c8572022cb083855b
Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
Date: 2020-09-28 (Mon, 28 Sep 2020)
Changed paths:
M llvm/include/llvm/Transforms/Coroutines.h
M llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
M llvm/lib/Passes/PassBuilder.cpp
M llvm/lib/Transforms/Coroutines/CMakeLists.txt
M llvm/lib/Transforms/Coroutines/CoroFrame.cpp
M llvm/lib/Transforms/Coroutines/CoroInternal.h
M llvm/lib/Transforms/Coroutines/CoroSplit.cpp
M llvm/lib/Transforms/Coroutines/Coroutines.cpp
A llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll
A llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll
A llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-02.ll
A llvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll
Log Message:
-----------
[Coroutines] Reuse storage for local variables with non-overlapping lifetimes
bug 45566 shows the process of building coroutine frame won't consider
that the lifetimes of different local variables are not overlapped,
which means the compiler could generates smaller frame.
This patch calculate the lifetime range of each alloca by StackLifetime
class. Then the patch build non-overlapped sets for allocas whose
lifetime ranges are not overlapped. We use the largest type in a
non-overlapped set as the field type in the frame. In insertSpills
process, if we find the type of field is not the same with the alloca,
we cast the pointer to the field type to the pointer to the alloca type.
Since the lifetime range of alloca in one non-overlapped set is not
overlapped with each other, it should be ok to reuse the storage space
in the frame.
Test plan: check-llvm, check-clang, cppcoro, folly
Reviewers: junparser, lxfind, modocache
Differential Revision: https://reviews.llvm.org/D87596
More information about the All-commits
mailing list