Igor Kudrin
b1554fe080
[Linker] Do not keep a private member of a non-prevailing comdat group ( #69143 )
...
`IRMover` links in referenced private global values unconditionally, see
`IRLinker::shouldLink()`. If they are part of a non-prevailing comdat,
this leads to duplication of the values. Full and Thin LTO avoid
duplication by changing the linkage of members of non-prevailing comdat
groups to `available_externally`, which was implemented in
https://reviews.llvm.org/D34803 and https://reviews.llvm.org/D135427 .
This patch does the same for `Linker`, but limits the effect only to
private members without aliases to minimize interference.
Motivation example:
```
> cat foo.h
inline int foo(int a) { return a + 1; }
> cat bar.cpp
#include "foo.h"
int bar(int a) { return foo(a + 1); }
> cat main.cpp
#include "foo.h"
int bar(int a);
int main(int argc, const char* argv[]) { return bar(argc) + foo(argc); }
> clang++ -c -flto -fprofile-instr-generate main.cpp -o main.o
> clang++ -c -flto -fprofile-instr-generate bar.cpp -o bar.o
> clang++ -fuse-ld=lld -fprofile-instr-generate main.o bar.o -o test1
> ./test1
> llvm-profdata merge --text default.profraw -o -
_Z3fooi
# Counter Values:
2
> llvm-link main.o bar.o -o combined.o
> clang++ -fuse-ld=lld -fprofile-instr-generate combined.o -o test2
> ./test2
> llvm-profdata merge --text default.profraw -o -
_Z3fooi
# Counter Values:
4
```
2023-10-29 01:04:24 +07:00
..
2023-07-14 09:07:11 +02:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00
2022-12-14 12:58:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00
2022-06-02 09:40:56 +02:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-21 22:15:01 -05:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00
2023-01-25 22:38:53 -04:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00
2022-12-13 16:43:43 +01:00
2023-10-29 01:04:24 +07:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00
2022-06-02 09:40:56 +02:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2023-01-19 18:28:02 +00:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2023-01-05 14:51:37 -05:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-14 12:49:44 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2023-03-14 08:42:44 +09:00
2023-01-25 22:38:53 -04:00
2022-12-13 16:43:43 +01:00
2022-07-06 10:18:33 -07:00
2022-07-06 10:18:33 -07:00
2022-07-18 09:35:12 -07:00
2022-08-18 16:28:55 -07:00
2022-08-18 16:28:55 -07:00
2023-03-15 01:13:08 -04:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-14 13:03:08 +01:00
2022-12-13 16:43:43 +01:00
2023-01-17 12:22:01 +01:00
2023-06-16 00:49:59 +02:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2023-07-12 12:03:44 +02:00
2023-01-17 11:58:06 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2023-10-16 12:17:24 +02:00
2023-10-16 12:17:24 +02:00
2023-01-17 12:28:41 +01:00
2023-10-16 12:17:24 +02:00
2023-10-16 12:17:24 +02:00
2022-03-22 16:46:48 +04:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-12-13 16:43:43 +01:00
2022-06-02 09:40:56 +02:00