This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Bug middle-end/15855] [3.4/4.0 Regression] g++ crash with -O2and -O3 on input file


This patch conditionally creates GLOBAL_VAR before the initial
translation into SSA form (and thus before the initial call
to compute_may_aliases).

This is vital to avoid compile time and memory explosions in
code with a large number of calls and a large number of call
clobbered variables -- rather than creating lots of virtual
operands at each call site, we create a single V_MAY_DEF
for GLOBAL_VAR.  The first may-alias pass would take care of
this stuff for us -- but waiting until then means that the
into-ssa translation has to deal with all these extra 
operands.

To give you some idea of what "extra" means -- the function in
question has ~1800 call sites.  Each of the call sites has
approximately 800 V_MAY_DEFs and 1000 VUSEs without this 
patch.  That's err, a lot of operands to deal with.


Here's some of the key timevars which show the effect of this change:

 garbage collection    :   2.82 ( 4%) usr   0.01 ( 0%) sys   2.82 ( 4%)
 tree PTA              :   0.96 ( 1%) usr   0.00 ( 0%) sys   0.97 ( 1%)
 tree alias analysis   :   5.61 ( 9%) usr   0.05 ( 0%) sys   5.62 ( 7%)
 tree PHI insertion    :   4.85 ( 7%) usr   0.18 ( 2%) sys   5.04 ( 7%)
 tree SSA rewrite      :   8.08 (12%) usr   0.21 ( 2%) sys   8.35 (11%)
 tree SSA other        :  10.63 (16%) usr   1.04 (10%) sys  10.91 (14%)
 tree operand scan     :   6.20 ( 9%) usr   0.97 ( 9%) sys   7.89 (10%)
 dominator optimization:   1.69 ( 3%) usr   0.10 ( 1%) sys   1.76 ( 2%)
 tree CCP              :   0.42 ( 1%) usr   0.09 ( 1%) sys   0.44 ( 1%)
 tree SSA to normal    :   0.50 ( 1%) usr   0.52 ( 5%) sys   1.24 ( 2%)
 tree rename SSA copies:   0.22 ( 0%) usr   0.32 ( 3%) sys   0.55 ( 1%)
 dominance frontiers   :   0.02 ( 0%) usr   0.01 ( 0%) sys   0.06 ( 0%)
 expand                :   2.20 ( 3%) usr   0.19 ( 2%) sys   2.27 ( 3%)
 TOTAL                 :  65.47            10.83            76.53

And after this patch:

 garbage collection (none :-)
 tree PTA              :   0.15 ( 0%) usr   0.00 ( 0%) sys   0.15 ( 0%)
 tree alias analysis   :   4.17 (14%) usr   0.03 ( 0%) sys   4.19 (11%)
 tree PHI insertion    :   0.28 ( 1%) usr   0.01 ( 0%) sys   0.28 ( 1%)
 tree SSA rewrite      :   0.42 ( 1%) usr   0.02 ( 0%) sys   0.46 ( 1%)
 tree SSA other        :   1.26 ( 4%) usr   0.82 ( 9%) sys   1.99 ( 5%)
 tree operand scan     :   1.16 ( 4%) usr   0.73 ( 8%) sys   1.95 ( 5%)
 dominator optimization:   1.32 ( 4%) usr   0.11 ( 1%) sys   1.58 ( 4%)
 tree CCP              :   0.08 ( 0%) usr   0.00 ( 0%) sys   0.12 ( 0%)
 tree SSA to normal    :   0.22 ( 1%) usr   0.00 ( 0%) sys   0.18 ( 0%)
 tree rename SSA copies:   0.03 ( 0%) usr   0.00 ( 0%) sys   0.06 ( 0%)
 expand                :   1.31 ( 4%) usr   0.15 ( 2%) sys   1.50 ( 4%)
 TOTAL                 :  30.26             9.04            39.37

Those were the big improvements -- there were several other passes which
appear to show small improvements.  Overall we're looking at more than
a 50% reduction in compile time and since GC fell off the timevar
charts, I can make an educated guess that we're allocating a lot less
memory too.

The may-aliasing code is still a major time-sink and I expect to find
further small gains in that code.

Bootstrapped and regression tested on i686-pc-linux-gnu.


Attachment: PPP
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]