[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-bugs
Subject: [llvm-bugs] [Bug 55798] Slow optimization of global array of structs on 32-bit architectures
From: LLVM Bugs via llvm-bugs <llvm-bugs () lists ! llvm ! org>
Date: 2022-05-31 17:29:41
Message-ID: 20220531172941.d7786204f1b4b101 () email ! llvm ! org
[Download RAW message or body]
[Attachment #2 (text/html)]
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55798>55798</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Slow optimization of global array of structs on 32-bit architectures
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jfgoog
</td>
</tr>
</table>
<pre>
This bug was originally reported in the Android NDK as \
https://github.com/android/ndk/issues/1418. I have tried to significantly reduce the \
code compared to the original report.
[slow-compile.tar.gz](https://github.com/llvm/llvm-project/files/8807399/slow-compile.tar.gz)
[settings.ll.txt](https://github.com/llvm/llvm-project/files/8807436/settings.ll.txt)
The attached code declares a global array of structs in table/settings.h, containing \
about 400 elements: `const SettingDesc _settings[] = { ... }`
The code is extremely slow to compile on several architectures, but particularly bad \
on 32-bit ARM and x86:
```
clang++ --target=aarch64-linux-android21
real 0m19.253s
user 0m19.206s
sys 0m0.044s
clang++ --target=x86_64-linux-android21
real 0m20.832s
user 0m20.642s
sys 0m0.188s
clang++ --target=armv7a-linux-android21
real 4m53.908s
user 4m53.748s
sys 0m0.088s
clang++ --target=i686-linux-android21
real 1m22.726s
user 1m22.565s
sys 0m0.149s
```
The slowness only occurs when optimizing. It appears to be related to trying to \
optimize the special function `__cxx_global_var_init`. Unfortunately, because this \
function does exist explicitly in the code, there is no way to set the `optnone` \
attribute on it.
I collected the following timing data for arm32 (for brevity, only including the \
parts that account for the huge amount of time):
```
===-------------------------------------------------------------------------===
Miscellaneous Ungrouped Timers
===-------------------------------------------------------------------------===
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name \
--- 296.1065 (100.0%) 0.0817 ( 95.7%) 296.1882 (100.0%) 296.2507 (100.0%) Code \
Generation Time 0.0427 ( 0.0%) 0.0036 ( 4.3%) 0.0463 ( 0.0%) 0.0470 ( \
0.0%) LLVM IR Generation Time 296.1492 (100.0%) 0.0854 (100.0%) 296.2346 \
(100.0%) 296.2977 (100.0%) Total
===-------------------------------------------------------------------------===
Instruction Selection and Scheduling
===-------------------------------------------------------------------------===
Total Execution Time: 295.7564 seconds (295.8187 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name \
--- 292.1253 ( 98.8%) 0.0280 ( 87.5%) 292.1533 ( 98.8%) 292.2149 ( 98.8%) DAG \
Combining after legalize types 1.3959 ( 0.5%) 0.0000 ( 0.0%) 1.3959 ( 0.5%) \
1.3961 ( 0.5%) DAG Combining 1 1.3061 ( 0.4%) 0.0040 ( 12.5%) 1.3101 ( 0.4%) \
1.3105 ( 0.4%) Instruction Scheduling 0.8146 ( 0.3%) 0.0000 ( 0.0%) 0.8146 ( \
0.3%) 0.8147 ( 0.3%) DAG Combining 2 0.0390 ( 0.0%) 0.0000 ( 0.0%) 0.0390 \
( 0.0%) 0.0390 ( 0.0%) Type Legalization 0.0200 ( 0.0%) 0.0000 ( 0.0%) \
0.0200 ( 0.0%) 0.0201 ( 0.0%) Instruction Selection 0.0094 ( 0.0%) 0.0000 ( \
0.0%) 0.0094 ( 0.0%) 0.0094 ( 0.0%) Instruction Creation 0.0079 ( 0.0%) \
0.0000 ( 0.0%) 0.0079 ( 0.0%) 0.0079 ( 0.0%) Vector Legalization 0.0060 ( \
0.0%) 0.0000 ( 0.0%) 0.0060 ( 0.0%) 0.0060 ( 0.0%) DAG Legalization 0.0003 \
( 0.0%) 0.0000 ( 0.0%) 0.0003 ( 0.0%) 0.0003 ( 0.0%) Instruction \
Scheduling Cleanup 295.7244 (100.0%) 0.0320 (100.0%) 295.7564 (100.0%) 295.8187 \
(100.0%) Total
===-------------------------------------------------------------------------===
... Pass execution timing report ...
===-------------------------------------------------------------------------===
Total Execution Time: 295.9915 seconds (296.0539 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name \
--- 295.7507 ( 99.9%) 0.0358 ( 49.8%) 295.7864 ( 99.9%) 295.8489 ( 99.9%) ARM \
Instruction Selection <everything else in this section deleted>
295.9198 (100.0%) 0.0717 (100.0%) 295.9915 (100.0%) 296.0539 (100.0%) Total
===-------------------------------------------------------------------------===
Clang front-end time report
===-------------------------------------------------------------------------===
Total Execution Time: 296.3532 seconds (296.4156 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name \
--- 296.2545 (100.0%) 0.0986 (100.0%) 296.3532 (100.0%) 296.4156 (100.0%) Clang \
front-end timer 296.2545 (100.0%) 0.0986 (100.0%) 296.3532 (100.0%) 296.4156 \
(100.0%) Total ```
</pre>
<img width="1px" height="1px" alt="" \
src="http://email.email.llvm.org/o/eJzNWFtzmzgU_jXOi8YMCHF78EOadDuZbTs7m7T7mBEgY7UYPEg \
kcX_9fhL4CmSTmW4bj43Fkc5V3zm6pHW-XdytpCJpW5BHrkjdyEJWvCy3pBGbutEiJ7IieiXIZZU3tczJ5-s_C \
UautN6omX85o3_gW0i9alMnq9d44d1ItKr8O55SqVYoNDzmxQ65ISv-IIhuJITrmihZVHIpM15pqzZvM2E1ZnV \
uHusNb7qRhrizsLfPmbnXM_eyfwbvVFk_zg2PLIWjeeMUP2bB9YzGz9hblg-7v_mmqb-JTON1CQnG6Dh2Iz9J0 \
BqTTZODaqG1rArllKWjn_RPUMv80Kg9k7tXaZ93iAnXmmcrxMhGLBdZiYgpwklR1ilCxZuGb0m9JEo3baaVnVK \
eluJY-mpGryCg0lxWIBCe1q0mzHWJKMVaVNq4QWahizFKk9uO71qojNzvhCAKcJvMfPyid8RxHPxfg-fcYmsoc \
CeedAPhmHcTXDPHfXxJXRElHkRjzc9WUiM8bWNCcwW0agJ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o0Pa5OfjIqfkrt5Pgx-h0mlnzsptkWp2P \
FdELBlOKp8fQwC-5otHfF4Fi5m7BXKZ8cP0I_Vn6F3d9Ad5S8TvfU-BH6V7iKLclUzN3wdTGfHD9CNxib1OuOL \
2mTeifHD-njmUWuSsGrdnOocai8lA1XPItd6o4seH2pHuuw9fqtroTmjPsXV2anvVt_-k1vd0FhBryJlTBJvOB \
0JQwdN_CT37kSmkl3-11h4iQnKAliS2fJ8YIHhrhDyQmDRQmLk0GHuQp4pjzN_Ctzx7DFwQkTJkqcoez5COch1 \
e9pcnDgXDPz3x-bnXhJPAruyBtCdR_9sW2enYK3Cm7zuTIHcbJs6krPBTZ45rTVY_sN4Dp0_AAnyjNcMy8Ifye \
uzdmFjZ-Cknh8u2_dGOuwvgxOQSOT0vxC_ccAHbstucgXfp74Cb_QUpdicWtu9_orj-7ghHP71O3k4Sbv5Obvo \
m3KxavvU_eXz0EQJfHFasGyIIoEZxljqYh4uKQijZZ5FmcRzfw0uSh5ikqw6O4yL-SCupQiSz0vognznDxCCaI \
uW3opS7EpnTFXrLksHaPYqZviollYG9K2UOgspdLq0ImlQhaVEDv5vNWrull8WxZ1XVxYaxfW1H8BQeEGGQ">
[Attachment #3 (text/plain)]
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic