From patchwork Mon Nov 1 19:21:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 69829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E9D15B70E4 for ; Tue, 2 Nov 2010 06:22:07 +1100 (EST) Received: (qmail 27682 invoked by alias); 1 Nov 2010 19:22:03 -0000 Received: (qmail 27673 invoked by uid 22791); 1 Nov 2010 19:22:02 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Nov 2010 19:21:56 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oA1JLt12009177 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 1 Nov 2010 15:21:55 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oA1JLs5l031508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 1 Nov 2010 15:21:55 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id oA1JLrL7019565 for ; Mon, 1 Nov 2010 20:21:53 +0100 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id oA1JLr66019530 for gcc-patches@gcc.gnu.org; Mon, 1 Nov 2010 20:21:53 +0100 Date: Mon, 1 Nov 2010 20:21:53 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix -fcompare-debug issue in tree profiler (PR debug/46255) Message-ID: <20101101192153.GA29412@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 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. Jakub --- 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 (); +}