From patchwork Wed Nov 24 01:24:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 72784 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 8B001B7080 for ; Wed, 24 Nov 2010 12:25:31 +1100 (EST) Received: (qmail 18558 invoked by alias); 24 Nov 2010 01:25:27 -0000 Received: (qmail 18531 invoked by uid 22791); 24 Nov 2010 01:25:25 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_CF, TW_TM, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS 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; Wed, 24 Nov 2010 01:24:57 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAO1OsBw025851 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 23 Nov 2010 20:24:55 -0500 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oAO1OqMe018078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 23 Nov 2010 20:24:54 -0500 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.4/8.14.4) with ESMTP id oAO1Opof028897 for ; Tue, 23 Nov 2010 23:24:52 -0200 Received: from livre.localdomain (aoliva@localhost [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id oAO1Ootk004805; Tue, 23 Nov 2010 23:24:50 -0200 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id oAO1Onkl004803; Tue, 23 Nov 2010 23:24:49 -0200 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: [PR debug/46258] tree cfgcleanup BB marking vs debug stmts Date: Tue, 23 Nov 2010 23:24:49 -0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 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 When cleaning up the tree^Wtuples CFG, we will sometimes replace uses of SSA names with other values. Problem is, if the only tuples modified in a dominated block are debug stmts, there may be divergence between -g and -g0 compilations, as there was with the given testcase in the PR (from the GCC testsuite, so not included in the patch): a block visited containing a modified debug stmt was successfully simplified in the cfgcleanup loop that visits only blocks marked before. I suppose this may be exposing a weakness in our block marking strategy, for the block could have been cleaned up in both cases, and after this change, it isn't before a subsequence full cfgcleanup run. However, in this patch, I'm only addressing the -g/-g0 divergence. Regstrapped on x86_64-linux-gnu and i686-pc-linux-gnu. Ok to install? for gcc/ChangeLog from Alexandre Oliva PR debug/46258 * tree-cfg.c (replace_uses_by): Don't mark BBs as altered on debug stmts. Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c.orig 2010-11-18 10:37:23.716685868 -0200 +++ gcc/tree-cfg.c 2010-11-18 10:37:31.701412567 -0200 @@ -1570,7 +1570,7 @@ replace_uses_by (tree name, tree val) size_t i; fold_stmt_inplace (stmt); - if (cfgcleanup_altered_bbs) + if (cfgcleanup_altered_bbs && !is_gimple_debug (stmt)) bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index); /* FIXME. This should go in update_stmt. */