for  gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/43650
	PR debug/44181
	PR debug/44247
	* tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Skip
	debug stmts.
	(canonicalize_loop_ivs): Likewise.

Index: gcc/tree-ssa-loop-manip.c
===================================================================
--- gcc/tree-ssa-loop-manip.c.orig	2010-06-11 09:16:28.000000000 -0300
+++ gcc/tree-ssa-loop-manip.c	2010-06-11 09:17:38.000000000 -0300
@@ -1081,7 +1081,7 @@ tree_transform_and_unroll_loop (struct l
 
   /* Finally create the new counter for number of iterations and add the new
      exit instruction.  */
-  bsi = gsi_last_bb (exit_bb);
+  bsi = gsi_last_nondebug_bb (exit_bb);
   exit_if = gsi_stmt (bsi);
   create_iv (exit_base, exit_step, NULL_TREE, loop,
 	     &bsi, false, &ctr_before, &ctr_after);
@@ -1217,7 +1217,7 @@ canonicalize_loop_ivs (struct loop *loop
 	gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
     }
 
-  gsi = gsi_last_bb (bump_in_latch ? loop->latch : loop->header);
+  gsi = gsi_last_nondebug_bb (bump_in_latch ? loop->latch : 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);
 
