summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-20 01:29:43 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-20 01:29:43 +0000
commite88bb3286d921153b834f4677dd0e7c7ec57f632 (patch)
treec81b2b6144d7b5c7ede0be2fbe0f15356a34c424 /gcc
parent5ce7279733af9142174b11fcb4e8768bd3efe1b5 (diff)
downloadgcc-e88bb3286d921153b834f4677dd0e7c7ec57f632.tar.gz
* tree-ssa-loop-niter.c (assert_loop_rolls_lt): Convert the operands
of compare to the same type. * cfgloopmanip.c (add_loop): Update information about loop exits. (loop_version): Remove the innermost loop requirement. * tree-ssa-loop-manip.c (determine_exit_conditions): Convert bounds to sizetype for pointers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126796 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/cfgloopmanip.c15
-rw-r--r--gcc/tree-ssa-loop-manip.c6
-rw-r--r--gcc/tree-ssa-loop-niter.c10
4 files changed, 31 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index eb3e3e447cd..4a999b0281d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2007-07-20 Zdenek Dvorak <dvorakz@suse.cz>
+
+ * tree-ssa-loop-niter.c (assert_loop_rolls_lt): Convert the operands
+ of compare to the same type.
+ * cfgloopmanip.c (add_loop): Update information about loop exits.
+ (loop_version): Remove the innermost loop requirement.
+ * tree-ssa-loop-manip.c (determine_exit_conditions): Convert bounds
+ to sizetype for pointers.
+
2007-07-18 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.in (D32PBIT_FUNCS): Add _sd_to_tf and _tf_to_sd.
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 92ab088ea40..83c4c570c5a 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -411,6 +411,8 @@ add_loop (struct loop *loop, struct loop *outer)
basic_block *bbs;
int i, n;
struct loop *subloop;
+ edge e;
+ edge_iterator ei;
/* Add it to loop structure. */
place_new_loop (loop);
@@ -441,6 +443,15 @@ add_loop (struct loop *loop, struct loop *outer)
}
}
+ /* Update the information about loop exit edges. */
+ for (i = 0; i < n; i++)
+ {
+ FOR_EACH_EDGE (e, ei, bbs[i]->succs)
+ {
+ rescan_loop_exit (e, false, false);
+ }
+ }
+
free (bbs);
}
@@ -1283,10 +1294,6 @@ loop_version (struct loop *loop,
struct loop *nloop;
basic_block cond_bb;
- /* CHECKME: Loop versioning does not handle nested loop at this point. */
- if (loop->inner)
- return NULL;
-
/* Record entry and latch edges for the loop */
entry = loop_preheader_edge (loop);
irred_flag = entry->flags & EDGE_IRREDUCIBLE_LOOP;
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 3354fdea6df..35bf97895b5 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -670,13 +670,17 @@ determine_exit_conditions (struct loop *loop, struct tree_niter_desc *desc,
tree base = desc->control.base;
tree step = desc->control.step;
tree bound = desc->bound;
- tree type = TREE_TYPE (base);
+ tree type = TREE_TYPE (step);
tree bigstep, delta;
tree min = lower_bound_in_type (type, type);
tree max = upper_bound_in_type (type, type);
enum tree_code cmp = desc->cmp;
tree cond = boolean_true_node, assum;
+ /* For pointers, do the arithmetics in the type of step (sizetype). */
+ base = fold_convert (type, base);
+ bound = fold_convert (type, bound);
+
*enter_cond = boolean_false_node;
*exit_base = NULL_TREE;
*exit_step = NULL_TREE;
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index e209f732a3b..fdce4be01d4 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -918,8 +918,9 @@ assert_loop_rolls_lt (tree type, affine_iv *iv0, affine_iv *iv1,
/* And then we can compute iv0->base - diff, and compare it with
iv1->base. */
- mbzl = fold_build2 (MINUS_EXPR, type1, iv0->base, diff);
- mbzr = iv1->base;
+ mbzl = fold_build2 (MINUS_EXPR, type1,
+ fold_convert (type1, iv0->base), diff);
+ mbzr = fold_convert (type1, iv1->base);
}
else
{
@@ -934,8 +935,9 @@ assert_loop_rolls_lt (tree type, affine_iv *iv0, affine_iv *iv1,
iv1->base, bound);
}
- mbzl = iv0->base;
- mbzr = fold_build2 (MINUS_EXPR, type1, iv1->base, diff);
+ mbzl = fold_convert (type1, iv0->base);
+ mbzr = fold_build2 (MINUS_EXPR, type1,
+ fold_convert (type1, iv1->base), diff);
}
if (!integer_nonzerop (assumption))