[improved-aliasing]: Remove possible O(n^2) behavior in call clobbering
Daniel Berlin
dberlin@dberlin.org
Mon Sep 12 02:43:00 GMT 2005
Right now we do things like:
if (pi->pt_vars)
EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, bi)
mark_call_clobbered (referenced_var (j));
mark_call_clobbered, in turn, is:
/* Mark variable VAR as being clobbered by function calls. */
static inline void
mark_call_clobbered (tree var)
{
bitmap_set_bit (call_clobbered_vars, DECL_UID (var));
ssa_call_clobbered_cache_valid = false;
ssa_ro_call_cache_valid = false;
}
Note we do a linear iteration (bitmap walk) -> hashtable lookup
(referenced var lookup) -> bit find and set (bitmap_set_bit).
All to do a bitmap union.
if we had a
static inline void
mark_bitmap_call_clobbered (bitmap ids)
{
bitmap_ior_into (call_clobbered_vars, ids);
ssa_call_clobbered_cache_valid = false;
ssa_ro_call_cache_valid = false;
}
You could then just replace it with
if (pt->pt_vars)
mark_bitmap_call_clobbered (pi->pt_vars)
Which is what i've done on improved-aliasing :)
One could apply the same trick to the mainline, if they felt so
inclined.
Bootstrapped and regtested on i686-pc-linux-gnu.
Applied to improved-aliasing-branch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bitmapcallclobbers.diff
Type: text/x-patch
Size: 3572 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050912/6b39baee/attachment.bin>
More information about the Gcc-patches
mailing list