re PR middle-end/46885 (ICE: in gsi_insert_seq_nodes_after, at gimple-iterator.c:251 with -ftree-parallelize-loops -g)

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.

	* gcc.dg/autopar/pr46885.c: New test.

From-SVN: r167801
This commit is contained in:
Jakub Jelinek 2010-12-14 15:11:16 +01:00 committed by Jakub Jelinek
parent 8236c8eb4f
commit f5b77e7d99
4 changed files with 34 additions and 1 deletions

View File

@ -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

View File

@ -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.

View File

@ -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;
}

View File

@ -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);