From patchwork Mon Apr 9 06:44:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 151410 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 92536B7011 for ; Mon, 9 Apr 2012 16:45:13 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1334558714; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:From:To:Subject:References:Date: In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=EAKdKwn3qiSJ2fM+fcIz 2y3SB5g=; b=XsjVA05appO+H1brP9MYp515f3PyWsFi7CBG8uot+daT6OEGY6YN gaX1QNgb0QtC9RbWPcWDLBGHyKGVOYjnDJ0o6IzqJZJLJWVxLtCLYcAOjfEES5se x2P5/6rnD4BiCfa8d0Rf8pibrxWAnBRIkyLKVMSHF4VV8XCZFV4U2/s= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:From:To:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=F6Dl2E4ruh5Pk2ql7lJwW9mlg+Lye0ce2qJTMEfc2YumisPKVXCGT8BNLeKh2v /SH9/U7bLQFOeYK+VpVJNcTm4wD/U96PotxqDsSxEk+wy2tQYV+P5llyRtNvbkcz pP8emC2DAMR1U46689lwx/KvWYhNhQWKQ/gFZbCq4PD1I=; Received: (qmail 27591 invoked by alias); 9 Apr 2012 06:45:08 -0000 Received: (qmail 27581 invoked by uid 22791); 9 Apr 2012 06:45:06 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, 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; Mon, 09 Apr 2012 06:44:51 +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.14.4/8.14.4) with ESMTP id q396ipcs000344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Apr 2012 02:44:51 -0400 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q396inWL000818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 9 Apr 2012 02:44:50 -0400 Received: from livre.localdomain (livre.oliva.athome.lsd.ic.unicamp.br [172.31.160.2]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.5/8.14.5) with ESMTP id q396inlZ010016 for ; Mon, 9 Apr 2012 03:44:49 -0300 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id q396im5G002893; Mon, 9 Apr 2012 03:44:48 -0300 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id q396ilol002891; Mon, 9 Apr 2012 03:44:47 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: Re: fix incorrect debug temp added by df-problems References: Date: Mon, 09 Apr 2012 03:44:47 -0300 In-Reply-To: (Alexandre Oliva's message of "Thu, 27 Oct 2011 11:41:50 -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 On Oct 27, 2011, Alexandre Oliva wrote: > pr43165.c -Os -g exercises a bug in df-problems WRT the introduction of > debug temps. After pro_and_epilogue, the function was optimized to this: > push bp > mov bp,sp > # debug insn referencing bp > pop bp > I don't know why we bother to preserve and set up bp, it's not used in > nondebug insns (and even with -g0 we still emit it). GCC 4.5 did > better, but that's a different issue I haven't addressed. > The problem I address here is that the debug insn references bp, but > df-problems sees bp is dead at the debug insn during backward scanning, > and decides we have to emit a debug temp before its last use. > However, there isn't a last use: the set is dead, but it isn't regarded > as such because bp is in artificial_uses at the end of the block. For > this reason, df_create_unused_note refrains from emitting the note and > resetting the debug uses. > However, the decision to emit a debug temp before the last bp use > remains in effect, so when the backward scanning reaches the push bp, it > emits a debug temp bound to the *previous* value of bp, and replaces > the debug use of bp with that. Oops. > This patch arranges for us to not decide a debug use is dead if we won't > emit a REG_DEAD or REG_UNUSED note for it, because it is > artificially-used or an ignored stack reg. An alternative would be to > remove any pending dead_debug entry from the list when we encounter a > set, but this is cheaper and it *should* be equivalent. > With this patch, the debug insn remains using bp, and no debug temp is > introduced. > Regstrapped on x86_64-linux-gnu and i686-linux-gnu. Ok to install? Apologies, I've just re-posted this patch claiming it had to do with pr50826. Maybe it does (I'm no longer sure I actually ran into the same problem there), but this was the thread in which I first posted it, so I'll follow up here. Regstrapped and retested. Ok? This fixes a bug in pr43165.c with -Os -g. for gcc/ChangeLog from Alexandre Oliva * df-problems.c (df_note_bb_compute): Do not take note of debug uses for whose REGs we won't emit DEAD or UNUSED notes. Index: gcc/df-problems.c =================================================================== --- gcc/df-problems.c.orig 2012-04-08 01:50:45.379141149 -0300 +++ gcc/df-problems.c 2012-04-08 02:05:13.406574358 -0300 @@ -3528,7 +3528,12 @@ df_note_bb_compute (unsigned int bb_inde { if (debug_insn > 0) { - dead_debug_add (&debug, use, uregno); + /* We won't add REG_UNUSED or REG_DEAD notes for + these, so we don't have to mess with them in + debug insns either. */ + if (!bitmap_bit_p (artificial_uses, uregno) + && (!df_ignore_stack_reg (uregno))) + dead_debug_add (&debug, use, uregno); continue; } break;