OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a blank line in ChangeLog
[pf3gnuchains/gcc-fork.git]
/
gcc
/
tree-ssa-loop-niter.c
diff --git
a/gcc/tree-ssa-loop-niter.c
b/gcc/tree-ssa-loop-niter.c
index
cf2f455
..
15ea06b
100644
(file)
--- a/
gcc/tree-ssa-loop-niter.c
+++ b/
gcc/tree-ssa-loop-niter.c
@@
-1,5
+1,5
@@
/* Functions to determine/estimate number of iterations of a loop.
/* Functions to determine/estimate number of iterations of a loop.
- Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
, 2011, 2012
Free Software Foundation, Inc.
This file is part of GCC.
Free Software Foundation, Inc.
This file is part of GCC.
@@
-762,8
+762,7
@@
number_of_iterations_lt_to_ne (tree type, affine_iv *iv0, affine_iv *iv1,
else if (POINTER_TYPE_P (type))
noloop = fold_build2 (GT_EXPR, boolean_type_node,
iv0->base,
else if (POINTER_TYPE_P (type))
noloop = fold_build2 (GT_EXPR, boolean_type_node,
iv0->base,
- fold_build2 (POINTER_PLUS_EXPR, type,
- iv1->base, tmod));
+ fold_build_pointer_plus (iv1->base, tmod));
else
noloop = fold_build2 (GT_EXPR, boolean_type_node,
iv0->base,
else
noloop = fold_build2 (GT_EXPR, boolean_type_node,
iv0->base,
@@
-788,10
+787,9
@@
number_of_iterations_lt_to_ne (tree type, affine_iv *iv0, affine_iv *iv1,
noloop = boolean_false_node;
else if (POINTER_TYPE_P (type))
noloop = fold_build2 (GT_EXPR, boolean_type_node,
noloop = boolean_false_node;
else if (POINTER_TYPE_P (type))
noloop = fold_build2 (GT_EXPR, boolean_type_node,
- fold_build2 (POINTER_PLUS_EXPR, type,
- iv0->base,
- fold_build1 (NEGATE_EXPR,
- type1, tmod)),
+ fold_build_pointer_plus (iv0->base,
+ fold_build1 (NEGATE_EXPR,
+ type1, tmod)),
iv1->base);
else
noloop = fold_build2 (GT_EXPR, boolean_type_node,
iv1->base);
else
noloop = fold_build2 (GT_EXPR, boolean_type_node,
@@
-1166,16
+1164,13
@@
number_of_iterations_le (tree type, affine_iv *iv0, affine_iv *iv1,
if (integer_nonzerop (iv0->step))
{
if (POINTER_TYPE_P (type))
if (integer_nonzerop (iv0->step))
{
if (POINTER_TYPE_P (type))
- iv1->base = fold_build2 (POINTER_PLUS_EXPR, type, iv1->base,
- build_int_cst (type1, 1));
+ iv1->base = fold_build_pointer_plus_hwi (iv1->base, 1);
else
iv1->base = fold_build2 (PLUS_EXPR, type1, iv1->base,
build_int_cst (type1, 1));
}
else if (POINTER_TYPE_P (type))
else
iv1->base = fold_build2 (PLUS_EXPR, type1, iv1->base,
build_int_cst (type1, 1));
}
else if (POINTER_TYPE_P (type))
- iv0->base = fold_build2 (POINTER_PLUS_EXPR, type, iv0->base,
- fold_build1 (NEGATE_EXPR, type1,
- build_int_cst (type1, 1)));
+ iv0->base = fold_build_pointer_plus_hwi (iv0->base, -1);
else
iv0->base = fold_build2 (MINUS_EXPR, type1,
iv0->base, build_int_cst (type1, 1));
else
iv0->base = fold_build2 (MINUS_EXPR, type1,
iv0->base, build_int_cst (type1, 1));
@@
-1281,13
+1276,14
@@
number_of_iterations_cond (struct loop *loop,
practice, but it is simple enough to manage. */
if (!integer_zerop (iv0->step) && !integer_zerop (iv1->step))
{
practice, but it is simple enough to manage. */
if (!integer_zerop (iv0->step) && !integer_zerop (iv1->step))
{
+ tree step_type = POINTER_TYPE_P (type) ? sizetype : type;
if (code != NE_EXPR)
return false;
if (code != NE_EXPR)
return false;
- iv0->step = fold_binary_to_constant (MINUS_EXPR, type,
+ iv0->step = fold_binary_to_constant (MINUS_EXPR,
step_
type,
iv0->step, iv1->step);
iv0->no_overflow = false;
iv0->step, iv1->step);
iv0->no_overflow = false;
- iv1->step = build_int_cst (type, 0);
+ iv1->step = build_int_cst (
step_
type, 0);
iv1->no_overflow = true;
}
iv1->no_overflow = true;
}
@@
-2294,7
+2290,10
@@
find_loop_niter_by_eval (struct loop *loop, edge *exit)
/* Loops with multiple exits are expensive to handle and less important. */
if (!flag_expensive_optimizations
&& VEC_length (edge, exits) > 1)
/* Loops with multiple exits are expensive to handle and less important. */
if (!flag_expensive_optimizations
&& VEC_length (edge, exits) > 1)
- return chrec_dont_know;
+ {
+ VEC_free (edge, heap, exits);
+ return chrec_dont_know;
+ }
FOR_EACH_VEC_ELT (edge, exits, i, ex)
{
FOR_EACH_VEC_ELT (edge, exits, i, ex)
{