From patchwork Sat Feb 5 12:05:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Zhang X-Patchwork-Id: 81998 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 AEBABB7125 for ; Sat, 5 Feb 2011 23:06:55 +1100 (EST) Received: (qmail 26435 invoked by alias); 5 Feb 2011 12:06:53 -0000 Received: (qmail 26427 invoked by uid 22791); 5 Feb 2011 12:06:52 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 05 Feb 2011 12:06:44 +0000 Received: (qmail 13180 invoked from network); 5 Feb 2011 12:06:40 -0000 Received: from unknown (HELO ?192.168.1.102?) (jie@127.0.0.2) by mail.codesourcery.com with ESMTPA; 5 Feb 2011 12:06:40 -0000 Message-ID: <4D4D3D16.5090405@codesourcery.com> Date: Sat, 05 Feb 2011 20:05:42 +0800 From: Jie Zhang User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101213 Lightning/1.0b2 Icedove/3.1.7 MIME-Version: 1.0 To: Jeff Law CC: gcc-patches@gcc.gnu.org Subject: Re: Fix a bug in merging uninitialized refs into a single web References: <4D245036.4040807@codesourcery.com> <4D24B3E1.1040500@redhat.com> <4D252724.7050200@codesourcery.com> <4D4ADB82.4070107@redhat.com> In-Reply-To: <4D4ADB82.4070107@redhat.com> 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 Jeff, On 02/04/2011 12:44 AM, Jeff Law wrote: > Sorry for the long delay -- I probably should have asked someone else to > own this since my initial comments were solely on the CLOBBER issue and > I didn't have any familiarity with the web pass. > No problem. Thanks for review! :-) > On 01/05/11 19:21, Jie Zhang wrote: >> Thanks for review. Yeah. I thought about ignoring the clobber at first. >> But later I found there was a bug in the code which merges uninitialized >> refs into a single web and fixing that bug should also fix the issue I >> encountered. So I just try to fix that bug which will be safer and >> easier for me. > So just so I'm certain I understand the problem. In the original > testcase a naked CLOBBER was the "set" that triggered the problem, but > this problem can occur for assignments to any uninitialized pseudo, such > as in examples you provided below. > > When we see a set to an uninitialized pseudo, we're losing the saved > DF_REF_UID which allows us to combine all the uninitialized uses into a > single web. Right? > Yes. My patch just prevents this losing. > Assuming that those statements are correct, the patch is OK. I would > suggest including both the testcase derived from dhrystone as well as > the one in this message in the testsuite. > That test case is already in the testsuite. I just update that test case to check the issue I found. I have committed the attached patch on trunk. Regards, PR debug/42631 * web.c (entry_register): Don't clobber the number of the first uninitialized reference in used[]. testsuite/ PR debug/42631 * gcc.dg/pr42631.c: Update test. * gcc.dg/pr42631-2.c: New test. Index: testsuite/gcc.dg/pr42631-2.c =================================================================== --- testsuite/gcc.dg/pr42631-2.c (revision 0) +++ testsuite/gcc.dg/pr42631-2.c (revision 0) @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -funroll-loops -fdump-rtl-web" } */ + +foo() +{ +} + +/* { dg-final { scan-rtl-dump-not "Web oldreg" "web" } } */ +/* { dg-final { cleanup-rtl-dump "web" } } */ Index: testsuite/gcc.dg/pr42631.c =================================================================== --- testsuite/gcc.dg/pr42631.c (revision 169850) +++ testsuite/gcc.dg/pr42631.c (working copy) @@ -14,10 +14,13 @@ combine uninitialized uses into a single web. */ /* { dg-do compile } */ -/* { dg-options "-g -O1 -funroll-loops -fcompare-debug" } */ +/* { dg-options "-g -O1 -funroll-loops -fcompare-debug -fdump-rtl-web" } */ void foo() { unsigned k; while (--k > 0); } + +/* { dg-final { scan-rtl-dump-not "Web oldreg" "web" } } */ +/* { dg-final { cleanup-rtl-dump "web" } } */ Index: web.c =================================================================== --- web.c (revision 169850) +++ web.c (working copy) @@ -260,7 +260,11 @@ entry_register (struct web_entry *entry, and there won't be any use for the other values when we get to this point. */ if (used[REGNO (reg)] != 1) - newreg = reg, used[REGNO (reg)] = 1; + { + newreg = reg; + if (!used[REGNO (reg)]) + used[REGNO (reg)] = 1; + } else { newreg = gen_reg_rtx (GET_MODE (reg));