Initialize counters in autoFDO to zero, not to uninitialized.
authorMartin Liska <mliska@suse.cz>
Thu, 27 Jul 2017 12:53:34 +0000 (14:53 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 27 Jul 2017 12:53:34 +0000 (12:53 +0000)
2017-07-27  Martin Liska  <mliska@suse.cz>

* auto-profile.c (afdo_annotate_cfg): Assign zero counts to
BBs and edges seen by autoFDO.

From-SVN: r250621

gcc/ChangeLog
gcc/auto-profile.c

index 5fcaae2..cf39fda 100644 (file)
@@ -1,3 +1,8 @@
+2017-07-27  Martin Liska  <mliska@suse.cz>
+
+       * auto-profile.c (afdo_annotate_cfg): Assign zero counts to
+       BBs and edges seen by autoFDO.
+
 2017-07-27  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/81502
index 71c06f3..552e333 100644 (file)
@@ -1547,9 +1547,11 @@ afdo_annotate_cfg (const stmt_set &promoted_stmts)
     edge e;
     edge_iterator ei;
 
-    bb->count = profile_count::uninitialized ();
+    /* As autoFDO uses sampling approach, we have to assume that all
+       counters are zero when not seen by autoFDO.  */
+    bb->count = profile_count::zero ().afdo ();
     FOR_EACH_EDGE (e, ei, bb->succs)
-      e->count = profile_count::uninitialized ();
+      e->count = profile_count::zero ().afdo ();
 
     if (afdo_set_bb_count (bb, promoted_stmts))
       set_bb_annotated (bb, &annotated_bb);