diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/autopar/pr46885.c | 23 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-manip.c | 5 |
4 files changed, 34 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4efa6f..9416805 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2010-12-14 Jakub Jelinek <jakub@redhat.com> + PR debug/46885 + * tree-ssa-loop-manip.c (canonicalize_loop_ivs): Use gsi_last_bb + instead of gsi_last_nondebug_bb if bump_in_latch. + PR tree-optimization/46909 * gimple-fold.c (and_var_with_comparison_1): Save partial result even in the is_and case, if both partial results diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0d20e51..1057858 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2010-12-14 Jakub Jelinek <jakub@redhat.com> + PR debug/46885 + * gcc.dg/autopar/pr46885.c: New test. + PR tree-optimization/46909 * gcc.c-torture/execute/pr46909-1.c: New test. * gcc.c-torture/execute/pr46909-2.c: New test. diff --git a/gcc/testsuite/gcc.dg/autopar/pr46885.c b/gcc/testsuite/gcc.dg/autopar/pr46885.c new file mode 100644 index 0000000..9560c92 --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr46885.c @@ -0,0 +1,23 @@ +/* PR debug/46885 */ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-parallelize-loops=4 -fcompare-debug -fno-tree-dominator-opts -funswitch-loops" } */ + +static inline void +bar (int i) +{ + (void) i; +} + +int +foo (int *begin, int *end) +{ + int s = 0; + int *i; + for (i = begin; i != end; ++i) + { + bar (0); + if (begin) + return s; + } + return 0; +} diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 87b2c0d..8176ed8 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -1221,7 +1221,10 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch) gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts); } - gsi = gsi_last_nondebug_bb (bump_in_latch ? loop->latch : loop->header); + if (bump_in_latch) + gsi = gsi_last_bb (loop->latch); + else + gsi = gsi_last_nondebug_bb (loop->header); create_iv (build_int_cst_type (type, 0), build_int_cst (type, 1), NULL_TREE, loop, &gsi, bump_in_latch, &var_before, NULL); |