-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
| Bugzilla Link | 11502 |
| Resolution | FIXED |
| Resolved on | Nov 04, 2020 15:42 |
| Version | trunk |
| OS | Linux |
| Attachments | Preprocessed source that triggers bug. |
| CC | @efriedma-quic,@ldalessa |
Extended Description
We have a number of large tables of structs (lock structures) that are statically allocated and zero initialized, as displayed in the included preprocessed source. In llvm-2.9, using llvm-gcc, a .ll output is approximately 30k. In llvm-3.0, using clang-3.0, the .ll output is 25MB, and using gcc-4.6.2/dragonegg-3.0 the .ll output is 75MB.
A discussion with Duncan on irc shows that this seems to be due to how llvm choses to represent the tables a struct with lots of fields rather than a struct with one array field. I don't know why this happens (maybe it has something to do with how we specify the zero initialization?). A trace of the three compilations for the preprocessed source is below.
luked@node2x6x2a ~/temp $ time /u/luked/local/llvm-gcc4.2-2.9-x86_64-linux/bin/llvm-g++ -O0 -m64 -emit-llvm -o preprocessed.ll -S preprocessed.cpp
real 0m0.126s
user 0m0.102s
sys 0m0.022s
luked@node2x6x2a ~/temp $ ls -l preprocessed.ll
-rw-r--r-- 1 luked people 33762 Dec 7 12:17 preprocessed.ll
luked@node2x6x2a ~/temp $ clang -v
clang version 3.0 (tags/RELEASE_30/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
luked@node2x6x2a ~/temp $ time clang -O0 -m64 -emit-llvm -o preprocessed.ll -S preprocessed.cpp
real 0m0.695s
user 0m0.579s
sys 0m0.115s
luked@node2x6x2a ~/temp $ ls -l preprocessed.ll
-rw-r--r-- 1 luked people 24166071 Dec 7 12:17 preprocessed.ll
luked@node2x6x2a ~/temp $ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/localdisk/luked/local/gcc-4.6.2/bin/../libexec/gcc/x86_64-redhat-linux-gnu/4.6.2/lto-wrapper
Target: x86_64-redhat-linux-gnu
Configured with: ../configure --prefix=/u/luked/local/gcc-4.6.2 --enable-languages=c,c++ --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-plugin --with-arch_32=i686 --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --build=x86_64-redhat-linux-gnu --disable-nls --enable-checking=release --without-ppl --without-cloog
Thread model: posix
gcc version 4.6.2 (GCC)
luked@node2x6x2a ~/temp $ time gcc -fplugin=dragonegg -O0 -m64 -flto -o preprocessed.ll -S preprocessed.cpp
real 0m18.737s
user 0m2.698s
sys 0m16.025s
luked@node2x6x2a ~/temp $ ls -l preprocessed.ll
-rw-r--r-- 1 luked people 74496790 Dec 7 12:18 preprocessed.ll