summaryrefslogtreecommitdiff
path: root/gcc/cfgloopanal.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-06 16:22:45 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-06 16:22:45 +0000
commitd583c97934c7af62fd9c8d741c41c742365e4dfd (patch)
treef6fbb89a772fc389ce8c8e8e32cde9cbd8d3a80a /gcc/cfgloopanal.c
parent10f4615f3fc365d0444390f69078dfb784fe9802 (diff)
downloadgcc-d583c97934c7af62fd9c8d741c41c742365e4dfd.tar.gz
* cfgloopanal.c (get_loop_hot_path): New function.
* tree-ssa-lop-ivcanon.c (struct loop_size): Add CONSTANT_IV, NUM_NON_PURE_CALLS_ON_HOT_PATH, NUM_PURE_CALLS_ON_HOT_PATH, NUM_BRANCHES_ON_HOT_PATH. (tree_estimate_loop_size): Compute the new values. (try_unroll_loop_completely): Disable unrolling of loops with only calls or too many branches. (tree_unroll_loops_completely): Deal also with outer loops of hot loops. * cfgloop.h (get_loop_hot_path): Declare. * params.def (PARAM_MAX_PEEL_BRANCHES): New parameters. * invoke.texi (max-peel-branches): Document. * gcc.dg/tree-ssa/loop-1.c: Make to look like a good unroling candidate still. * gcc.dg/tree-ssa/loop-23.c: Likewise. * gcc.dg/tree-ssa/cunroll-1.c: Unrolling now happens early. * gcc.dg/tree-prof/unroll-1.c: Remove confused dg-options. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193246 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopanal.c')
-rw-r--r--gcc/cfgloopanal.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c
index c3cf3edf9b9..ba7c2626635 100644
--- a/gcc/cfgloopanal.c
+++ b/gcc/cfgloopanal.c
@@ -483,3 +483,36 @@ single_likely_exit (struct loop *loop)
VEC_free (edge, heap, exits);
return found;
}
+
+
+/* Gets basic blocks of a LOOP. Header is the 0-th block, rest is in dfs
+ order against direction of edges from latch. Specially, if
+ header != latch, latch is the 1-st block. */
+
+VEC (basic_block, heap) *
+get_loop_hot_path (const struct loop *loop)
+{
+ basic_block bb = loop->header;
+ VEC (basic_block, heap) *path = NULL;
+ bitmap visited = BITMAP_ALLOC (NULL);
+
+ while (true)
+ {
+ edge_iterator ei;
+ edge e;
+ edge best = NULL;
+
+ VEC_safe_push (basic_block, heap, path, bb);
+ bitmap_set_bit (visited, bb->index);
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if ((!best || e->probability > best->probability)
+ && !loop_exit_edge_p (loop, e)
+ && !bitmap_bit_p (visited, e->dest->index))
+ best = e;
+ if (!best || best->dest == loop->header)
+ break;
+ bb = best->dest;
+ }
+ BITMAP_FREE (visited);
+ return path;
+}