From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17673 invoked by alias); 8 Jul 2011 10:12:40 -0000 Received: (qmail 17665 invoked by uid 22791); 8 Jul 2011 10:12:39 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mailout-de.gmx.net (HELO mailout-de.gmx.net) (213.165.64.23) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Fri, 08 Jul 2011 10:12:18 +0000 Received: (qmail invoked by alias); 08 Jul 2011 10:12:15 -0000 Received: from mon.egee-see.org (EHLO [139.91.70.93]) [139.91.70.93] by mail.gmx.net (mp009) with SMTP; 08 Jul 2011 12:12:15 +0200 Date: Fri, 08 Jul 2011 10:20:00 -0000 From: Dimitrios Apostolou To: Richard Guenther cc: gcc-patches@gcc.gnu.org, Paolo Bonzini , Steven Bosscher Subject: Re: [df-scan.c] Optimise DF_REFs ordering in collection_rec, use HARD_REG_SETs instead of bitmaps In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (LNX 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg00608.txt.bz2 On Fri, 8 Jul 2011, Richard Guenther wrote: > On Fri, Jul 8, 2011 at 5:20 AM, Dimitrios Apostolou wrote: >> Hello list, >> >> The attached patch does two things for df_get_call_refs(): >> * First it uses HARD_REG_SETs for defs_generated and >> regs_invalidated_by_call, instead of bitmaps. Replacing in total more than >> 400K calls (for my testcase) to bitmap_bit_p() with the much faster >> TEST_HARD_REG_BIT, reduces the total instruction count from about 13M to >> 1.5M. >> * Second it produces the REFs in REGNO order, which is important to keep the >> collection_rec sorted most times, and avoid expensive calls to qsort(). >> Thanks to Paolo Bonzini for idea and mentoring. >> >> The second part makes a big difference if accompanied with another patch in >> df_insn_refs_collect(). I'll post a followup patch, that is unfortunately >> unstable for some of my tests, so I'd appreciate any comments. > > Did you check the impact on memory usage? I suppose on targets > with not many hard registers it should even improve, but do we expect > memory usage to be worse in any case? Hi Richard, I didn't check memory usage, is that important? Since the struct bitmap is fairly bulky, it should take an arch with lots of hard regs (which one has the most?). But still a few bytes tradeoff wouldn't be acceptable for a much faster type? And IMHO it makes the code better to understand, since once you see HARD_REG_SET you know you can't expect else. FWIW I'm now in the process of converting all other bitmap uses for hard regs, to HARD_REG_SETs, at least within DF. I'm not sure whether performance gains will be visible, however, not much code is as hot as df_get_call_refs(). Thanks, Dimitris