diff mbox

[lra] patch to speed more compilation of PR54146

Message ID CABu31nNAr4Yx-3iJaBo_JGJhf031iqeRXXYw8hiorbnWDj42sA@mail.gmail.com
State New
Headers show

Commit Message

Steven Bosscher Oct. 8, 2012, 10:31 a.m. UTC
On Sun, Oct 7, 2012 at 5:59 PM, Vladimir Makarov wrote:
>         * lra-lives.c (lra_start_point_ranges, lra_finish_point_ranges):
>         Remove.
>         (process_bb_lives): Change start regno in
>         EXECUTE_IF_SET_IN_BITMAP.  Iterate on DF_LR_IN (bb) instead of
>         pseudos_live_through_calls.

This can be done a bit better still by checking whether the
pseudos_live_through_calls set is empty:

        * lra-lives.c (process_bb_lives): At the top of a basic block, break
        from the loop over pseudos_live_through_calls if the set is empty.



This test is extremely cheap (the load for the cardinality test
re-used by sparseset_bit_p) and it cuts down the time spent in live
range chains even further (especially e.g. for blocks that don't
contain calls).

OK for the branch if it passes bootstrap+testing on x86_64-unknown-linux-gnu?

Ciao!
Steven

Comments

Vladimir Makarov Oct. 8, 2012, 8:21 p.m. UTC | #1
On 10/08/2012 06:31 AM, Steven Bosscher wrote:
> On Sun, Oct 7, 2012 at 5:59 PM, Vladimir Makarov wrote:
>>          * lra-lives.c (lra_start_point_ranges, lra_finish_point_ranges):
>>          Remove.
>>          (process_bb_lives): Change start regno in
>>          EXECUTE_IF_SET_IN_BITMAP.  Iterate on DF_LR_IN (bb) instead of
>>          pseudos_live_through_calls.
> This can be done a bit better still by checking whether the
> pseudos_live_through_calls set is empty:
>
>          * lra-lives.c (process_bb_lives): At the top of a basic block, break
>          from the loop over pseudos_live_through_calls if the set is empty.
>
> --- lra-lives.c.orig   2012-10-08 12:24:10.000000000 +0200
> +++ lra-lives.c        2012-10-08 12:26:07.000000000 +0200
> @@ -751,8 +751,12 @@ process_bb_lives (basic_block bb)
>       mark_pseudo_dead (i);
>
>     EXECUTE_IF_SET_IN_BITMAP (DF_LR_IN (bb), FIRST_PSEUDO_REGISTER, j, bi)
> -    if (sparseset_bit_p (pseudos_live_through_calls, j))
> -      check_pseudos_live_through_calls (j);
> +    {
> +      if (sparseset_cardinality (pseudos_live_through_calls) == 0)
> +       break;
> +      if (sparseset_bit_p (pseudos_live_through_calls, j))
> +       check_pseudos_live_through_calls (j);
> +    }
>
>     incr_curr_point (freq);
>   }
>
>
> This test is extremely cheap (the load for the cardinality test
> re-used by sparseset_bit_p) and it cuts down the time spent in live
> range chains even further (especially e.g. for blocks that don't
> contain calls).
>
> OK for the branch if it passes bootstrap+testing on x86_64-unknown-linux-gnu?
>
>
Yes.  Thanks.
diff mbox

Patch

--- lra-lives.c.orig   2012-10-08 12:24:10.000000000 +0200
+++ lra-lives.c        2012-10-08 12:26:07.000000000 +0200
@@ -751,8 +751,12 @@  process_bb_lives (basic_block bb)
     mark_pseudo_dead (i);

   EXECUTE_IF_SET_IN_BITMAP (DF_LR_IN (bb), FIRST_PSEUDO_REGISTER, j, bi)
-    if (sparseset_bit_p (pseudos_live_through_calls, j))
-      check_pseudos_live_through_calls (j);
+    {
+      if (sparseset_cardinality (pseudos_live_through_calls) == 0)
+       break;
+      if (sparseset_bit_p (pseudos_live_through_calls, j))
+       check_pseudos_live_through_calls (j);
+    }

   incr_curr_point (freq);
 }