aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2016-05-20 12:59:08 +0000
committerJan Hubicka <hubicka@ucw.cz>2016-05-20 12:59:08 +0000
commit97098aea92059c56e5c00fc4f060de7f86885792 (patch)
tree68f6b8fbb27234c91e8d52822750ef532246bd69
parentd227595682396630ff3c2a89a06176bbcc9718f0 (diff)
* loop-doloop.c (doloop_optimize): Use get_estimated_loop_iterations_int
and get_max_loop_iterations_int. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@236509 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/loop-doloop.c20
2 files changed, 13 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1d5bca7131b..021f64e5bd8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2016-05-20 Jan Hubicka <hubicka@ucw.cz>
+ * loop-doloop.c (doloop_optimize): Use get_estimated_loop_iterations_int
+ and get_max_loop_iterations_int.
+
+2016-05-20 Jan Hubicka <hubicka@ucw.cz>
+
* tree-ssa-loop-niter.c (idx_infer_loop_bounds): We can not produce
realistic upper bounds here.
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index 940c966dc5a..6996c0bc0ef 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -610,7 +610,8 @@ doloop_optimize (struct loop *loop)
widest_int iterations, iterations_max;
rtx_code_label *start_label;
rtx condition;
- unsigned level, est_niter;
+ unsigned level;
+ HOST_WIDE_INT est_niter;
int max_cost;
struct niter_desc *desc;
unsigned word_mode_size;
@@ -635,21 +636,16 @@ doloop_optimize (struct loop *loop)
}
mode = desc->mode;
- est_niter = 3;
- if (desc->const_iter)
- est_niter = desc->niter;
- /* If the estimate on number of iterations is reliable (comes from profile
- feedback), use it. Do not use it normally, since the expected number
- of iterations of an unrolled loop is 2. */
- if (loop->header->count)
- est_niter = expected_loop_iterations (loop);
-
- if (est_niter < 3)
+ est_niter = get_estimated_loop_iterations_int (loop);
+ if (est_niter == -1)
+ est_niter = get_max_loop_iterations_int (loop);
+
+ if (est_niter >= 0 && est_niter < 3)
{
if (dump_file)
fprintf (dump_file,
"Doloop: Too few iterations (%u) to be profitable.\n",
- est_niter);
+ (unsigned int)est_niter);
return false;
}