From patchwork Fri Dec 4 11:57:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 552665 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2424D1402E2 for ; Fri, 4 Dec 2015 22:57:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=m0/WPzdO; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=fpelpSMSpMXp401Tpy8FROfQm5bPwt2Sp8IcFpBqHeHTAdY3oZpje eZzgCDI1wVc/+rFbyY2ZPxopuE4JZ74+gC02jIPH71S4lf3cFmQIeBJ75pfFmODs 2C7lfl6lDumRmHztbaqHllXU5kWwTQzG3Ojzp03lj7F4GZH9ge4ZE8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=ti/s6hwSqMfUXLvcvtBuvDgEfB0=; b=m0/WPzdOWmLoMYGme8xF osNdwhwcaPX40IV6HH9GSRGNBcmeUyURzPcZeuhs/qCkYYNpoHYExenGlDp8fzj5 80fuLnHnaHgjxe52/NB0yVCzVrorGjHIqovfkL7n19a5RNkmiRwSllbDFlxNHugw RTvl62e+hTXvAlqzwXkdw3w= Received: (qmail 30809 invoked by alias); 4 Dec 2015 11:57:22 -0000 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 Received: (qmail 30798 invoked by uid 89); 4 Dec 2015 11:57:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 04 Dec 2015 11:57:21 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 46C5DAAC1 for ; Fri, 4 Dec 2015 11:57:18 +0000 (UTC) Date: Fri, 4 Dec 2015 12:57:18 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Speedup bitmap_find_bit Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 This properly guards the bitmap_mem_desc.get_descriptor_for_instance call with GATHER_STATISTICS - the hashmap is globally initialized and thus a query isn't very well inline optimized even if the map is empty. Committed as obvious. Richard. 2015-12-04 Richard Biener * bitmap.c (bitmap_find_bit): Guard the bitmap descriptor query with GATHER_STATISTICS. Index: gcc/bitmap.c =================================================================== --- gcc/bitmap.c (revision 231256) +++ gcc/bitmap.c (working copy) @@ -487,9 +487,11 @@ bitmap_find_bit (bitmap head, unsigned i && head->first->next == NULL) return NULL; - /* Usage can be NULL due to allocated bitmaps for which we do not - call initialize function. */ - bitmap_usage *usage = bitmap_mem_desc.get_descriptor_for_instance (head); + /* Usage can be NULL due to allocated bitmaps for which we do not + call initialize function. */ + bitmap_usage *usage = NULL; + if (GATHER_STATISTICS) + usage = bitmap_mem_desc.get_descriptor_for_instance (head); /* This bitmap has more than one element, and we're going to look through the elements list. Count that as a search. */