mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 20:36:06 +00:00

Clang generates copy and dispose helper functions for each block literal on the stack. Often these functions are equivalent for different blocks. This commit makes changes to merge equivalent copy and dispose helper functions and reduce code size. To enable merging equivalent copy/dispose functions, the captured object infomation is encoded into the helper function name. This allows IRGen to check whether an equivalent helper function has already been emitted and reuse the function instead of generating a new helper function whenever a block is defined. In addition, the helper functions are marked as linkonce_odr to enable merging helper functions that have the same name across translation units and marked as unnamed_addr to enable the linker's deduplication pass to merge functions that have different names but the same content. rdar://problem/42640608 Differential Revision: https://reviews.llvm.org/D50152 llvm-svn: 339438
13 lines
147 B
C
13 lines
147 B
C
struct S0 {
|
|
S0();
|
|
S0(const S0 &) noexcept(false);
|
|
int a;
|
|
};
|
|
|
|
struct S {
|
|
void m() {
|
|
__block S0 x, y;
|
|
^{ (void)x; (void)y; };
|
|
}
|
|
};
|