public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix -fcompare-debug issue in tree profiler (PR debug/46255)
@ 2010-11-01 19:23 Jakub Jelinek
  2010-11-01 23:07 ` Richard Guenther
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2010-11-01 19:23 UTC (permalink / raw)
  To: gcc-patches

Hi!

While debug stmts are never considered to need fake edges, it currently
(incorrectly) makes a difference whether a stmt that needs fake edges
was the last one or not.  Fixed by disregarding any debug stmts
at the end of bb.

Bootstrapped/regtested on x86_64-linux and i686-linux.  Ok for trunk?

2010-11-01  Jakub Jelinek  <jakub@redhat.com>

	PR debug/46255
	* tree-cfg.c (gimple_flow_call_edges_add): Use gsi_last_nondebug_bb
	instead of gsi_last_bb.

	* gcc.dg/pr46255.c: New test.

--- gcc/tree-cfg.c.jj	2010-11-01 09:07:24.000000000 +0100
+++ gcc/tree-cfg.c	2010-11-01 14:03:05.000000000 +0100
@@ -6749,7 +6749,7 @@ gimple_flow_call_edges_add (sbitmap bloc
   if (check_last_block)
     {
       basic_block bb = EXIT_BLOCK_PTR->prev_bb;
-      gimple_stmt_iterator gsi = gsi_last_bb (bb);
+      gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb);
       gimple t = NULL;
 
       if (!gsi_end_p (gsi))
@@ -6783,7 +6783,7 @@ gimple_flow_call_edges_add (sbitmap bloc
       if (blocks && !TEST_BIT (blocks, i))
 	continue;
 
-      gsi = gsi_last_bb (bb);
+      gsi = gsi_last_nondebug_bb (bb);
       if (!gsi_end_p (gsi))
 	{
 	  last_stmt = gsi_stmt (gsi);
--- gcc/testsuite/gcc.dg/pr46255.c.jj	2010-11-01 14:04:55.000000000 +0100
+++ gcc/testsuite/gcc.dg/pr46255.c	2010-11-01 14:04:34.000000000 +0100
@@ -0,0 +1,12 @@
+/* PR debug/46255 */
+/* { dg-do compile } */
+/* { dg-options "-fcompare-debug -fprofile-generate -O" } */
+
+int bar (void);
+
+void
+foo (int i)
+{
+  while (i)
+    i = bar ();
+}

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-02 10:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-01 19:23 [PATCH] Fix -fcompare-debug issue in tree profiler (PR debug/46255) Jakub Jelinek
2010-11-01 23:07 ` Richard Guenther
2010-11-01 23:15   ` Jakub Jelinek
2010-11-02 10:51     ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).