From patchwork Fri Jun 11 19:18:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PR44181] skip debug insns when inserting IV updates Date: Fri, 11 Jun 2010 09:18:44 -0000 From: Alexandre Oliva X-Patchwork-Id: 55350 Message-Id: To: gcc-patches@gcc.gnu.org A number of graphite -fcompare-debug bug reports were fixed with this patch. The problem was that we inserted induction variable increment stmts before the last stmt in the block, but if the block ended with a fall-through, the insert would be before a non-debug stmt in the non-VTA case, whereas in the VTA case it could be before a debug stmt, after the non-debug stmt. Skipping trailing debug stmts so that we insert before the last non-debug stmt removed the codegen differences. Bootstrapped the compiler, along with the upcoming patch for PR43656, on x86_64-linux-gnu, with the following options: -O2 -g -fschedule-insns -fsched-pressure -funroll-loops -fgraphite-identity for stage2 and stage3 host, and for stage3 libs (also -fcompare-debug) I got build failures on zlib and libada, presumably because of this unusual combination of flags, but no -fcompare-debug errors. Ok to install? for gcc/ChangeLog from Alexandre Oliva 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);