[llvm] [GlobalMerge] Aggressively merge constants to reduce TOC entries (PR #111756)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 11:49:58 PDT 2024
efriedma-quic wrote:
```
static const int a[4000];
static const int b[4000];
static const int c[3000];
static const int d[3000];
int foo(int *, int*);
int int1() {
return foo(a, c);
}
int int2() {
return foo(b, d);
}
int int3() {
return foo(a, c);
}
int int4() {
return foo(b, d);
}
```
If you put "a" and "c" together, and "b" and "d" together, each function has one TOC load. If you merge a+b and c+d instead, each function has two TOC loads.
https://github.com/llvm/llvm-project/pull/111756
More information about the llvm-commits
mailing list