Add missing edge probabilities in expand_oacc_for, tile case
authorTom de Vries <tom@codesourcery.com>
Sun, 6 Aug 2017 09:56:38 +0000 (09:56 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Sun, 6 Aug 2017 09:56:38 +0000 (09:56 +0000)
 ;;   basic block 11, loop depth 2, freq 0, maybe hot
 ;;    prev block 22, next block 23, flags: (NEW, REACHABLE)
 ;;    pred:       22 (TRUE_VALUE)
 ;;                24 (TRUE_VALUE)
   ...
   if (.e_offset.15D.1971 < .e_bound.14D.1972)
-    goto <bb 23>; [100.00%] [count: INV]
+    goto <bb 23>; [80.01%] [count: INV]
   else
-    goto <bb 24>; [INV] [count: INV]
+    goto <bb 24>; [19.99%] [count: INV]

 ;;   basic block 23, loop depth 3, freq 0, maybe hot
 ;;    prev block 11, next block 24, flags: (NEW)
 ;;    pred:       11 [always]  (TRUE_VALUE)
 ;;                23 (TRUE_VALUE)
   ixD.1974 = .outer.4D.1967 + .e_offset.15D.1971;
   .e_offset.15D.1971 = .e_offset.15D.1971 + .e_step.16D.1973;
   if (.e_offset.15D.1971 < .e_bound.14D.1972)
-    goto <bb 23>; [INV] [count: INV]
+    goto <bb 23>; [80.01%] [count: INV]
   else
-    goto <bb 24>; [100.00%] [count: INV]
+    goto <bb 24>; [19.99%] [count: INV]

2017-08-06  Tom de Vries  <tom@codesourcery.com>

* omp-expand.c (expand_oacc_for): Add missing edge probability for tile
and element loops.

From-SVN: r250900

gcc/ChangeLog
gcc/omp-expand.c

index c06ef3f3633c3a1ea2dadd293e98d7dc6fa9072c..51ed7c9916231b39522bc6f07b9d2db86d911e2f 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-06  Tom de Vries  <tom@codesourcery.com>
+
+       * omp-expand.c (expand_oacc_for): Add missing edge probability for tile
+       and element loops.
+
 2017-08-06  Tom de Vries  <tom@codesourcery.com>
 
        * omp-expand.c (expand_oacc_for): Add missing edge probability for chunk
index 5772bd9e4a3a50a43088b89ac8ec028c6977a98d..0a0098af6695219ca15251aa22cdc9469a8e5459 100644 (file)
@@ -5663,9 +5663,16 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd)
          cont_bb = split->dest;
 
          split->flags ^= EDGE_FALLTHRU | EDGE_FALSE_VALUE;
-         make_edge (elem_cont_bb, elem_body_bb, EDGE_TRUE_VALUE);
+         split->probability = profile_probability::unlikely ().guessed ();
+         edge latch_edge
+           = make_edge (elem_cont_bb, elem_body_bb, EDGE_TRUE_VALUE);
+         latch_edge->probability = profile_probability::likely ().guessed ();
 
-         make_edge (body_bb, cont_bb, EDGE_FALSE_VALUE);
+         edge skip_edge = make_edge (body_bb, cont_bb, EDGE_FALSE_VALUE);
+         skip_edge->probability = profile_probability::unlikely ().guessed ();
+         edge loop_entry_edge = EDGE_SUCC (body_bb, 1 - skip_edge->dest_idx);
+         loop_entry_edge->probability
+           = profile_probability::likely ().guessed ();
 
          gsi = gsi_for_stmt (cont_stmt);
        }