diff mbox

Fix PR 59542: flow verification after compgotos

Message ID CAAe5K+WKXH6x_gbU7_-=fgFWGVvXPkL7-gf5RBmEY4DPA-26RA@mail.gmail.com
State New
Headers show

Commit Message

Teresa Johnson Dec. 19, 2013, 7:33 p.m. UTC
Computed goto duplication needs to fixup partition boundaries if it
performed any block duplication.

Bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for trunk?

2013-12-19  Teresa Johnson  <tejohnson@google.com>

        PR gcov-profile/59542
        * bb-reorder.c (duplicate_computed_gotos): Invoke fixup_partitions
        if we have made any changes.

Comments

Steven Bosscher Dec. 19, 2013, 10:06 p.m. UTC | #1
On Thu, Dec 19, 2013 at 8:33 PM, Teresa Johnson wrote:
> 2013-12-19  Teresa Johnson  <>
>
>         PR gcov-profile/59542
>         * bb-reorder.c (duplicate_computed_gotos): Invoke fixup_partitions
>         if we have made any changes.
>
> Index: bb-reorder.c
> ===================================================================
> --- bb-reorder.c        (revision 206100)
> +++ bb-reorder.c        (working copy)
> @@ -2390,6 +2390,7 @@ duplicate_computed_gotos (void)
>    basic_block bb, new_bb;
>    bitmap candidates;
>    int max_size;
> +  bool changed = false;
>
>    if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
>      return 0;
> @@ -2486,9 +2487,17 @@ duplicate_computed_gotos (void)
>        new_bb->aux = bb->aux;
>        bb->aux = new_bb;
>        new_bb->flags |= BB_VISITED;
> +      changed = true;
>      }
>
>  done:
> +  /* Duplicating blocks above will redirect edges and may cause hot blocks
> +     previously reached by both hot and cold blocks to become dominated only
> +     by cold blocks. This will cause the verification when leaving cfg layout
> +     mode to fail, and lead to now cold code in the hot section. Invoke
> +     fixup_partitions to address these problems.  */

Please remove the "This will ... problems." part. IMHO The first
sentence explains quite enough ;-)

> +  if (changed)
> +    fixup_partitions ();
>    cfg_layout_finalize ();
>
>    BITMAP_FREE (candidates);
>
>

This is OK.

Ciao!
Steven
Teresa Johnson Dec. 19, 2013, 10:11 p.m. UTC | #2
On Thu, Dec 19, 2013 at 2:06 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Thu, Dec 19, 2013 at 8:33 PM, Teresa Johnson wrote:
>> 2013-12-19  Teresa Johnson  <>
>>
>>         PR gcov-profile/59542
>>         * bb-reorder.c (duplicate_computed_gotos): Invoke fixup_partitions
>>         if we have made any changes.
>>
>> Index: bb-reorder.c
>> ===================================================================
>> --- bb-reorder.c        (revision 206100)
>> +++ bb-reorder.c        (working copy)
>> @@ -2390,6 +2390,7 @@ duplicate_computed_gotos (void)
>>    basic_block bb, new_bb;
>>    bitmap candidates;
>>    int max_size;
>> +  bool changed = false;
>>
>>    if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
>>      return 0;
>> @@ -2486,9 +2487,17 @@ duplicate_computed_gotos (void)
>>        new_bb->aux = bb->aux;
>>        bb->aux = new_bb;
>>        new_bb->flags |= BB_VISITED;
>> +      changed = true;
>>      }
>>
>>  done:
>> +  /* Duplicating blocks above will redirect edges and may cause hot blocks
>> +     previously reached by both hot and cold blocks to become dominated only
>> +     by cold blocks. This will cause the verification when leaving cfg layout
>> +     mode to fail, and lead to now cold code in the hot section. Invoke
>> +     fixup_partitions to address these problems.  */
>
> Please remove the "This will ... problems." part. IMHO The first
> sentence explains quite enough ;-)

Ok, done.

>
>> +  if (changed)
>> +    fixup_partitions ();
>>    cfg_layout_finalize ();
>>
>>    BITMAP_FREE (candidates);
>>
>>
>
> This is OK.

Thanks, committed as r206135.

Teresa

>
> Ciao!
> Steven
diff mbox

Patch

Index: bb-reorder.c
===================================================================
--- bb-reorder.c        (revision 206100)
+++ bb-reorder.c        (working copy)
@@ -2390,6 +2390,7 @@  duplicate_computed_gotos (void)
   basic_block bb, new_bb;
   bitmap candidates;
   int max_size;
+  bool changed = false;

   if (n_basic_blocks_for_fn (cfun) <= NUM_FIXED_BLOCKS + 1)
     return 0;
@@ -2486,9 +2487,17 @@  duplicate_computed_gotos (void)
       new_bb->aux = bb->aux;
       bb->aux = new_bb;
       new_bb->flags |= BB_VISITED;
+      changed = true;
     }

 done:
+  /* Duplicating blocks above will redirect edges and may cause hot blocks
+     previously reached by both hot and cold blocks to become dominated only
+     by cold blocks. This will cause the verification when leaving cfg layout
+     mode to fail, and lead to now cold code in the hot section. Invoke
+     fixup_partitions to address these problems.  */
+  if (changed)
+    fixup_partitions ();
   cfg_layout_finalize ();

   BITMAP_FREE (candidates);