From patchwork Fri Nov 26 03:50:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PR,debug/46338] avoid spurious BB splits for profiling Date: Thu, 25 Nov 2010 17:50:47 -0000 From: Alexandre Oliva X-Patchwork-Id: 73154 Message-Id: To: gcc-patches@gcc.gnu.org We don't want to use the locus information from a debug stmt to decide whether or not to split a BB, because this may lead to different decisions for -g and -g0 compilations. Regstrapped on x86_64-linux-gnu and i686-pc-linux-gnu. Ok? for gcc/ChangeLog from Alexandre Oliva PR debug/46338 * profile.c (branch_prob): Skip debug stmts for BB end locus. Index: gcc/profile.c =================================================================== --- gcc/profile.c.orig 2010-11-22 20:05:55.558067049 -0200 +++ gcc/profile.c 2010-11-23 23:31:07.309901035 -0200 @@ -937,10 +937,11 @@ branch_prob (void) /* It may happen that there are compiler generated statements without a locus at all. Go through the basic block from the last to the first statement looking for a locus. */ - for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi)) + for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); + gsi_prev (&gsi)) { last = gsi_stmt (gsi); - if (gimple_has_location (last)) + if (!is_gimple_debug (last) && gimple_has_location (last)) break; }