From patchwork Wed Jun 23 18:53:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Kuvyrkov X-Patchwork-Id: 56702 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 E0039B6F1A for ; Thu, 24 Jun 2010 04:54:16 +1000 (EST) Received: (qmail 10873 invoked by alias); 23 Jun 2010 18:54:14 -0000 Received: (qmail 10863 invoked by uid 22791); 23 Jun 2010 18:54:12 -0000 X-SWARE-Spam-Status: No, hits=-2.0 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; Wed, 23 Jun 2010 18:54:03 +0000 Received: (qmail 23781 invoked from network); 23 Jun 2010 18:54:01 -0000 Received: from unknown (HELO ?172.16.1.24?) (maxim@127.0.0.2) by mail.codesourcery.com with ESMTPA; 23 Jun 2010 18:54:01 -0000 Message-ID: <4C225847.1020900@codesourcery.com> Date: Wed, 23 Jun 2010 22:53:59 +0400 From: Maxim Kuvyrkov User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: Jeff Law CC: gcc-patches Subject: Re: 0003-Improve-VBEout-computation.patch References: <4C18F225.2040509@codesourcery.com> <4C18F446.20508@codesourcery.com> <4C1FAD3A.60401@redhat.com> <4C20A670.2040909@codesourcery.com> In-Reply-To: <4C20A670.2040909@codesourcery.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 On 6/22/10 4:02 PM, Maxim Kuvyrkov wrote: ... > I'll post another version of the patch in a couple of days when I finish > reworking other pieces of improvements to hoisting. Updated version. OK to check in? Thanks, diff --git a/gcc/gcse.c b/gcc/gcse.c index 103f0e0..22576ca 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -4171,8 +4171,16 @@ compute_code_hoist_vbeinout (void) FOR_EACH_BB_REVERSE (bb) { if (bb->next_bb != EXIT_BLOCK_PTR) - sbitmap_intersection_of_succs (hoist_vbeout[bb->index], - hoist_vbein, bb->index); + { + sbitmap_intersection_of_succs (hoist_vbeout[bb->index], + hoist_vbein, bb->index); + + /* One of the quirks of code hoisting algorithm in Muchnick + is that VBEout[BB] does not include expressions calculated + in BB itself and available at its end. Fix this. */ + sbitmap_a_or_b (hoist_vbeout[bb->index], + hoist_vbeout[bb->index], comp[bb->index]); + } changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb->index], antloc[bb->index], @@ -4184,7 +4192,17 @@ compute_code_hoist_vbeinout (void) } if (dump_file) - fprintf (dump_file, "hoisting vbeinout computation: %d passes\n", passes); + { + fprintf (dump_file, "hoisting vbeinout computation: %d passes\n", passes); + + FOR_EACH_BB (bb) + { + fprintf (dump_file, "vbein (%d): ", bb->index); + dump_sbitmap_file (dump_file, hoist_vbein[bb->index]); + fprintf (dump_file, "vbeout(%d): ", bb->index); + dump_sbitmap_file (dump_file, hoist_vbeout[bb->index]); + } + } } /* Top level routine to do the dataflow analysis needed by code hoisting. */ @@ -4298,6 +4316,11 @@ hoist_code (void) if (TEST_BIT (hoist_vbeout[bb->index], i) && TEST_BIT (transpout[bb->index], i)) { + /* If an expression is computed in BB and is available at end of + BB, hoist all occurences dominated by BB to BB. */ + if (TEST_BIT (comp[bb->index], i)) + hoistable++; + /* We've found a potentially hoistable expression, now we look at every block BB dominates to see if it computes the expression. */