[SMS] Fix a potential bug of schedule_reg_moves of SMS

Submitted by Felix Yang on Jan. 2, 2014, 2:17 p.m.

Details

Message ID CAFc0fxyhfTxvORJHJ_2CUOso9EN=Ls8q=4yE1Fm61j3-HsoxmQ@mail.gmail.com
State New
Headers show

Commit Message

Felix Yang Jan. 2, 2014, 2:17 p.m.
Sorry, the year of the date in ChangeLog is wrong, fix it.


Cheers,
Felix


On Thu, Jan 2, 2014 at 9:07 PM, Felix Yang <fei.yang0953@gmail.com> wrote:
> Hello Vladimir,
>   This patch fixes a trivial bug of SMS: distance1_uses needs to be
> initialized if newly allocated.
>   Since the original author of SMS is not active for a very long time,
> it would be nice if you can apply it for me : )
>   Thanks.
>
> Index: gcc/ChangeLog
> ===================================================================
> --- gcc/ChangeLog    (revision 206279)
> +++ gcc/ChangeLog    (working copy)
> @@ -1,3 +1,8 @@
> +2013-01-02  Felix Yang  <fei.yang0953@gmail.com>
> +
> +    * modulo-sched.c (schedule_reg_moves): Clear distance1_uses if it
> +    is newly allocated.
> +
>  2013-01-01  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
>
>      * config/nios2/nios2.h (BITS_PER_UNIT): Don't define it.
> Index: gcc/modulo-sched.c
> ===================================================================
> --- gcc/modulo-sched.c    (revision 206279)
> +++ gcc/modulo-sched.c    (working copy)
> @@ -766,6 +766,9 @@ schedule_reg_moves (partial_schedule_ptr ps)
>
>        distance1_uses = distances[1] ? sbitmap_alloc (g->num_nodes) : NULL;
>
> +      if (distance1_uses)
> +        bitmap_clear (distance1_uses);
> +
>        /* Every use of the register defined by node may require a different
>       copy of this register, depending on the time the use is scheduled.
>       Record which uses require which move results.  */
>
>
> Cheers,
> Felix

Comments

Jeff Law Jan. 6, 2014, 4:47 p.m.
On 01/02/14 07:17, Felix Yang wrote:
> +2014-01-02  Felix Yang<fei.yang0953@gmail.com>
> +
> +    * modulo-sched.c (schedule_reg_moves): Clear distance1_uses if it
> +    is newly allocated.
Thanks.  Applied.

If you have a testcase where failure to properly initialize 
distance1_uses resulted in some kind of unexpected behaviour, could you 
please post it along with details about the failure so that we can add 
it to the regression suite.

Thanks,
jeff

Patch hide | download patch | download mbox

Index: gcc/ChangeLog
==============================
=====================================
--- gcc/ChangeLog    (revision 206279)
+++ gcc/ChangeLog    (working copy)
@@ -1,3 +1,8 @@ 
+2014-01-02  Felix Yang  <fei.yang0953@gmail.com>
+
+    * modulo-sched.c (schedule_reg_moves): Clear distance1_uses if it
+    is newly allocated.
+
 2013-01-01  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

     * config/nios2/nios2.h (BITS_PER_UNIT): Don't define it.
Index: gcc/modulo-sched.c
===================================================================
--- gcc/modulo-sched.c    (revision 206279)
+++ gcc/modulo-sched.c    (working copy)
@@ -766,6 +766,9 @@  schedule_reg_moves (partial_schedule_ptr ps)

       distance1_uses = distances[1] ? sbitmap_alloc (g->num_nodes) : NULL;

+      if (distance1_uses)
+        bitmap_clear (distance1_uses);
+
       /* Every use of the register defined by node may require a different
      copy of this register, depending on the time the use is scheduled.
      Record which uses require which move results.  */