diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2023-11-19 08:43:05 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2024-01-17 07:47:37 +0000 |
commit | 0c42d1782e48d8ad578ace2065cce9b3615f97c0 (patch) | |
tree | 3dd2b3476a03aa17d296a73929640ec9f68a3570 /gcc/tree-vect-loop-manip.cc | |
parent | 25bb8a40abd91fccf9a59dd6518a7a283433dea3 (diff) | |
download | gcc-0c42d1782e48d8ad578ace2065cce9b3615f97c0.zip gcc-0c42d1782e48d8ad578ace2065cce9b3615f97c0.tar.gz gcc-0c42d1782e48d8ad578ace2065cce9b3615f97c0.tar.bz2 |
sched-deps.cc (find_modifiable_mems): Avoid exponential behavior [PR96388]
This patch avoids sched-deps.cc:find_inc() creating exponential number
of dependencies, which become memory and compilation time hogs.
Consider example (simplified from PR96388) ...
===
sp=sp-4 // sp_insnA
mem_insnA1[sp+A1]
...
mem_insnAN[sp+AN]
sp=sp-4 // sp_insnB
mem_insnB1[sp+B1]
...
mem_insnBM[sp+BM]
===
[For simplicity, let's assume find_inc(backwards==true)].
In this example find_modifiable_mems() will arrange for mem_insnA*
to be able to pass sp_insnA, and, while doing this, will create
dependencies between all mem_insnA*s and sp_insnB -- because sp_insnB
is a consumer of sp_insnA. After this sp_insnB will have N new
backward dependencies.
Then find_modifiable_mems() gets to mem_insnB*s and starts to create
N new dependencies for _every_ mem_insnB*. This gets us N*M new
dependencies.
In PR96833's testcase N and M are 10k-15k, which causes RAM usage of
30GB and compilation time of 30 minutes, with sched2 accounting for
95% of both metrics. After this patch the RAM usage is down to 1GB
and compilation time is down to 3-4 minutes, with sched2 no longer
standing out on -ftime-report or memory usage.
gcc/ChangeLog:
PR rtl-optimization/96388
PR rtl-optimization/111554
* sched-deps.cc (find_inc): Avoid exponential behavior.
Diffstat (limited to 'gcc/tree-vect-loop-manip.cc')
0 files changed, 0 insertions, 0 deletions