This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Fix PR 59542: flow verification after compgotos


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.

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);


-- 
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]