Bug 23928 - Exceptions require an excessive amount of compile-time memory
Summary: Exceptions require an excessive amount of compile-time memory
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: memory-hog
Depends on: 25663
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-17 15:51 UTC by Richard Biener
Modified: 2006-10-24 14:10 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
testcase (200.75 KB, application/octet-stream)
2005-09-18 09:15 UTC, Richard Biener
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2005-09-17 15:51:54 UTC
The tramp3d-v4.cpp testcase with flatten (aka leafify) enabled requires
excessive amount of memory for the compile, if exceptions are not
disabled via -fno-exceptions.

Compiling with -O2 -Dleafify=flatten -fno-exceptions mainline needs
at max. 670MB of ram, while omitting -fno-exceptions it tops out at
2.7GB(!).
 
Testing was done on x86_64 with 8GB ram to avoid hitting swap. ggc
params are --param ggc-min-expand=100 --param ggc-min-heapsize=131072.

The tramp3d-v4.cpp testcase is available from
http://www.tat.physik.uni-tuebingen.de/~rguenth/gcc/tramp3d-v4.cpp.gz

-ftime-report from the -fexceptions run shows

Execution times (seconds)
 garbage collection    :  19.16 ( 4%) usr   1.10 (11%) sys  20.33 ( 4%) wall   
   0 kB ( 0%) ggc
...
 integration           : 188.01 (41%) usr   2.53 (26%) sys 191.29 (40%) wall 
842654 kB (24%) ggc
...
 tree CFG cleanup      :  10.57 ( 2%) usr   0.05 ( 1%) sys  10.69 ( 2%) wall  
33061 kB ( 1%) ggc
 tree VRP              :   5.18 ( 1%) usr   0.14 ( 1%) sys   5.14 ( 1%) wall  
40349 kB ( 1%) ggc
 tree copy propagation :   5.46 ( 1%) usr   0.09 ( 1%) sys   5.56 ( 1%) wall   
5073 kB ( 0%) ggc
 tree store copy prop  :   1.10 ( 0%) usr   0.02 ( 0%) sys   0.97 ( 0%) wall   
1015 kB ( 0%) ggc
 tree find ref. vars   :   3.96 ( 1%) usr   0.05 ( 1%) sys   4.06 ( 1%) wall 
150561 kB ( 4%) ggc
 tree PTA              :  17.47 ( 4%) usr   0.29 ( 3%) sys  17.45 ( 4%) wall  
59716 kB ( 2%) ggc
 tree alias analysis   :  12.44 ( 3%) usr   0.61 ( 6%) sys  12.84 ( 3%) wall  
95403 kB ( 3%) ggc
 tree PHI insertion    :   2.25 ( 0%) usr   0.02 ( 0%) sys   2.49 ( 1%) wall  
35414 kB ( 1%) ggc
 tree SSA rewrite      :  11.87 ( 3%) usr   0.04 ( 0%) sys  11.91 ( 3%) wall 
203499 kB ( 6%) ggc
 tree SSA other        :   2.02 ( 0%) usr   0.22 ( 2%) sys   2.46 ( 1%) wall   
2499 kB ( 0%) ggc
 tree SSA incremental  :  25.40 ( 6%) usr   0.18 ( 2%) sys  26.07 ( 6%) wall  
63750 kB ( 2%) ggc
 tree operand scan     :  10.79 ( 2%) usr   1.18 (12%) sys  12.01 ( 3%) wall 
116147 kB ( 3%) ggc
 dominator optimization:  11.64 ( 3%) usr   0.08 ( 1%) sys  12.08 ( 3%) wall 
168798 kB ( 5%) ggc
...
 expand                :  15.71 ( 3%) usr   0.07 ( 1%) sys  15.54 ( 3%) wall 
194871 kB ( 6%) ggc
...
 TOTAL                 : 461.33             9.78           473.07           
3503243 kB
Comment 1 Richard Biener 2005-09-17 17:07:04 UTC
ipa-eh patch from

http://gcc.gnu.org/ml/gcc-patches/2005-09/msg00881.html

(with fix) does not really help.
Comment 2 Richard Biener 2005-09-17 18:00:54 UTC
eh-complexity patch from

http://gcc.gnu.org/ml/gcc-patches/2005-06/msg01052.html

slightly edited to apply (and approved by GeoffK in june) helps:

peak memory usage is down to 1.2GB.

 garbage collection    :  17.32 ( 6%) usr   0.84 (11%) sys  18.19 ( 6%) wall   
   0 kB ( 0%) ggc
 integration           :  29.85 (10%) usr   0.86 (11%) sys  30.90 (10%) wall
2695445 kB (234%) ggc
 tree PTA              :  15.98 ( 6%) usr   0.23 ( 3%) sys  15.50 ( 5%) wall  
59710 kB ( 5%) ggc
 tree alias analysis   :  11.35 ( 4%) usr   0.51 ( 7%) sys  12.34 ( 4%) wall  
95003 kB ( 8%) ggc
 tree PHI insertion    :   2.19 ( 1%) usr   0.02 ( 0%) sys   2.26 ( 1%) wall  
35414 kB ( 3%) ggc
 tree SSA rewrite      :  12.47 ( 4%) usr   0.11 ( 1%) sys  12.80 ( 4%) wall 
203797 kB (18%) ggc
 tree SSA other        :   1.81 ( 1%) usr   0.26 ( 3%) sys   2.03 ( 1%) wall   
2499 kB ( 0%) ggc
 tree SSA incremental  :  24.40 ( 8%) usr   0.10 ( 1%) sys  24.65 ( 8%) wall  
64150 kB ( 6%) ggc
 tree operand scan     :   9.95 ( 3%) usr   1.00 (13%) sys  11.09 ( 4%) wall 
116251 kB (10%) ggc
 dominator optimization:  11.43 ( 4%) usr   0.07 ( 1%) sys  11.36 ( 4%) wall 
168489 kB (15%) ggc
 TOTAL                 : 288.38             7.62           297.15           
1154283 kB
Comment 3 Richard Biener 2005-09-17 18:43:18 UTC
Extra ggc_collect after each optimize_inline_calls does not help reduce it further.
Comment 4 Richard Biener 2005-09-18 09:15:17 UTC
Created attachment 9757 [details]
testcase

Testcase attached as requested.
Comment 5 Richard Biener 2006-10-24 14:10:54 UTC
Fixed in 4.2.  Numbers are reasonable now:

rguenther@murzim:/space/rguenther/tramp3d> /usr/bin/time ~/bin/maxmem.sh ./install/bin/g++ -O2 -S -o /dev/null tramp3d-v4.cpp -Dleafify=flatten
total: 903456 kB
159.28user 5.17system 2:44.37elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (1major+387189minor)pagefaults 0swaps

rguenther@murzim:/space/rguenther/tramp3d> /usr/bin/time ~/bin/maxmem.sh ./install/bin/g++ -O2 -S -o /dev/null tramp3d-v4.cpp -Dleafify=flatten -fno-exceptions
total: 871928 kB
135.61user 3.35system 2:18.78elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+299059minor)pagefaults 0swaps