From: Jan Hubicka Date: Thu, 7 Jul 2016 11:50:55 +0000 (+0200) Subject: tree-scalar-evolution.c (iv_can_overflow_p): export. X-Git-Tag: upstream/12.2.0~45998 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=019d6598357659e05640cf762b75e18953f70fe9;p=platform%2Fupstream%2Fgcc.git tree-scalar-evolution.c (iv_can_overflow_p): export. * tree-scalar-evolution.c (iv_can_overflow_p): export. * tree-scalar-evolution.h (iv_can_overflow_p): Declare. * tree-ssa-loop-ivopts.c (alloc_iv): Use it. From-SVN: r238088 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 75f39de..fca1bac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-07-07 Jan Hubicka + + * tree-scalar-evolution.c (iv_can_overflow_p): export. + * tree-scalar-evolution.h (iv_can_overflow_p): Declare. + * tree-ssa-loop-ivopts.c (alloc_iv): Use it. + 2016-07-07 Ilya Enkovich PR ipa/71624 diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index e51f0aa..2097d81 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -3317,7 +3317,7 @@ scev_reset (void) use this test even for derived IVs not computed every iteration or hypotetical IVs to be inserted into code. */ -static bool +bool iv_can_overflow_p (struct loop *loop, tree type, tree base, tree step) { widest_int nit; diff --git a/gcc/tree-scalar-evolution.h b/gcc/tree-scalar-evolution.h index 8a87660..382d717 100644 --- a/gcc/tree-scalar-evolution.h +++ b/gcc/tree-scalar-evolution.h @@ -38,6 +38,7 @@ extern unsigned int scev_const_prop (void); extern bool expression_expensive_p (tree); extern bool simple_iv (struct loop *, struct loop *, tree, struct affine_iv *, bool); +extern bool iv_can_overflow_p (struct loop *, tree, tree, tree); extern tree compute_overall_effect_of_inner_loop (struct loop *, tree); /* Returns the basic block preceding LOOP, or the CFG entry block when diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 25b9780..6b403f5 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -1181,6 +1181,10 @@ alloc_iv (struct ivopts_data *data, tree base, tree step, iv->biv_p = false; iv->nonlin_use = NULL; iv->ssa_name = NULL_TREE; + if (!no_overflow + && !iv_can_overflow_p (data->current_loop, TREE_TYPE (base), + base, step)) + no_overflow = true; iv->no_overflow = no_overflow; iv->have_address_use = false;