Add missing edge probability in simd_clone_adjust
authorTom de Vries <tom@codesourcery.com>
Fri, 4 Aug 2017 07:27:05 +0000 (07:27 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Fri, 4 Aug 2017 07:27:05 +0000 (07:27 +0000)
Currently we generate an if with probability set on only one of the two edges:
  <bb 5> [0.00%] [count: INV]:
  _5 = mask.3[iter.6_3];
  if (_5 == 0)
    goto <bb 6>; [INV] [count: INV]
  else
    goto <bb 2>; [100.00%] [count: INV]

Add the missing edge probability, and set the split to unlikely/likely:
  if (_5 == 0)
    goto <bb 6>; [19.99%] [count: INV]
  else
    goto <bb 2>; [80.01%] [count: INV]

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

* omp-simd-clone.c (simd_clone_adjust): Add missing edge probability.

From-SVN: r250865

gcc/ChangeLog
gcc/omp-simd-clone.c

index ea78f4f46425581ad4d174f3b4b5ffd1501724e5..921430208447e1457342107be4497ddd233a072e 100644 (file)
@@ -1,3 +1,7 @@
+2017-08-04  Tom de Vries  <tom@codesourcery.com>
+
+       * omp-simd-clone.c (simd_clone_adjust): Add missing edge probability.
+
 2017-08-03  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin):
index a1a563e80943cb048ff8913146f18cd73f2ec2d9..fbb122cd1e0898a40e001396b8b6e07df3cb42a4 100644 (file)
@@ -1240,8 +1240,11 @@ simd_clone_adjust (struct cgraph_node *node)
       g = gimple_build_cond (EQ_EXPR, mask, build_zero_cst (TREE_TYPE (mask)),
                             NULL, NULL);
       gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING);
-      make_edge (loop->header, incr_bb, EDGE_TRUE_VALUE);
-      FALLTHRU_EDGE (loop->header)->flags = EDGE_FALSE_VALUE;
+      edge e = make_edge (loop->header, incr_bb, EDGE_TRUE_VALUE);
+      e->probability = profile_probability::unlikely ().guessed ();
+      edge fallthru = FALLTHRU_EDGE (loop->header);
+      fallthru->flags = EDGE_FALSE_VALUE;
+      fallthru->probability = profile_probability::likely ().guessed ();
     }
 
   basic_block latch_bb = NULL;