summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-niter.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r--gcc/tree-ssa-loop-niter.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 279718ee5e4..9956cc551b4 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -875,11 +875,11 @@ assert_loop_rolls_lt (tree type, affine_iv *iv0, affine_iv *iv1,
-step + 1 <= (iv1->base - iv0->base) <= MAX - step + 1
(where MAX is the maximum value of the unsigned variant of TYPE, and
- the computations in this formula are performed in full precision
- (without overflows).
+ the computations in this formula are performed in full precision,
+ i.e., without overflows).
Usually, for loops with exit condition iv0->base + step * i < iv1->base,
- we have a condition of form iv0->base - step < iv1->base before the loop,
+ we have a condition of the form iv0->base - step < iv1->base before the loop,
and for loops iv0->base < iv1->base - step * i the condition
iv0->base < iv1->base + step, due to loop header copying, which enable us
to prove the lower bound.
@@ -1374,6 +1374,10 @@ simplify_replace_tree (tree expr, tree old, tree new_tree)
if (!expr)
return NULL_TREE;
+ /* Do not bother to replace constants. */
+ if (CONSTANT_CLASS_P (old))
+ return expr;
+
if (expr == old
|| operand_equal_p (expr, old, 0))
return unshare_expr (new_tree);
@@ -2521,7 +2525,7 @@ record_estimate (struct loop *loop, tree bound, double_int i_bound,
list. */
if (upper)
{
- struct nb_iter_bound *elt = GGC_NEW (struct nb_iter_bound);
+ struct nb_iter_bound *elt = ggc_alloc_nb_iter_bound ();
elt->bound = i_bound;
elt->stmt = at_stmt;
@@ -2621,7 +2625,7 @@ array_at_struct_end_p (tree ref)
/* Unless the reference is through a pointer, the size of the array matches
its declaration. */
- if (!base || !INDIRECT_REF_P (base))
+ if (!base || (!INDIRECT_REF_P (base) && TREE_CODE (base) != MEM_REF))
return false;
for (;handled_component_p (ref); ref = parent)
@@ -2647,7 +2651,6 @@ array_at_struct_end_p (tree ref)
Therefore, continue checking. */
}
- gcc_assert (INDIRECT_REF_P (ref));
return true;
}