Hi,

this patch adds missing edge probabilities in expand_oacc_for, for the tile and element loops that are generated when the tile clause is used.


Committed.

Thanks,
- Tom
Add missing edge probabilities in expand_oacc_for, tile case

 ;;   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  <t...@codesourcery.com>

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

---
 gcc/omp-expand.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index 5772bd9..0a0098a 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -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);
 	}

Reply via email to