On Jan 16, 2013, Jakub Jelinek <ja...@redhat.com> wrote:

> On Wed, Jan 16, 2013 at 08:28:59AM -0200, Alexandre Oliva wrote:
>> PR49888 introduced clobber_overlapping_mems to detach VALUEs (and
>> variables bound to them) from MEMs as the MEMs are modified.  This
>> turned out to be quite expensive, particularly the computation of
>> canonical addresses passed to alias dependency.
>> 
>> This patch introduces caching of the canonical addresses to alleviate
>> this expensive operation.  We cache mappings that apply to the entire
>> function, from equivalences recorded in the global cselib table, and
>> mappings that apply only to the local basic block.  This cut down 2% of
>> a full regstrap cycle, and about 1% of the time it took to build target
>> libraries for C, C++ and Java.

> Can you safely cache the canon addresses already during vt_initialize
> (when cselib_* is still processing new insns, cselib VALUEs contain
> REGs and MEMs that are flushed at the end of processing the current bb
> in vt_initialize)?

No.  AFAICT we only call the address canonicalization function after
collecting all MOps, when the cselib table is fully constructed and
cleaned up from any local information, retaining only the global
equivalences.

> Also, what effects (if any) does the patch have on the
> .debug_info/.debug_loc size and coverage?

It shouldn't have any, since it's just caching results that would have
been recomputed over and over.  However, there's a possibility of being
“lucky” and recording an equivalence in the cache whose path would later
be removed from a dynamic set (say, if an incoming VALUE is reset and
re-bound within a block; I'm not sure this ever actually happens).  In
this case, these retained equivalences might enable alias analysis to
figure out that two memory refs do not overlap, and so one can be
retained in a dynamic equivalence list when we process a MOp that
modifies the other.  Or something ;-) It shouldn't really make any
difference, just speed things up a bit.  Paraphrasing Knuth, “I proved
it, but I didn't test it” ;-)

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

Reply via email to