From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 56C043858D1E for ; Tue, 30 Apr 2024 19:22:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 56C043858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 56C043858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714504936; cv=none; b=h3rEWonILgummb8tqba3kSVxfolqZN1mCReNgcTf70DG1hELP/BpEKouiNz9VkmGic7iH9eK0nz9pA4UwjtixZP2T99kr5hkO1jRR0v9fmhbzvemGUmPVYUSdtBQA7c1Vs5i72eKZ9ed8ByuOMhZFCRID10iK7x2DUMwDNIePYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714504936; c=relaxed/simple; bh=wfSAXk6btYIaHQr1uPqm3WbZ0zs8PZuqQRPO/BAjyBM=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=vRz7S3pulCAGx4vRatjNdADEA6ObP9OoqyeF6c0jALZOmrhHEDHuATzYyxOLkCRAi80aH2MhMut0PHtVBps3bXuQaQ4DXNGO4O079cvTZfCL5u+/mhS1lZcy1lQ6u6t3gEVFp0XOhg9U4kflmVUzj5BSYXh+rSaacMGV5NZsJTc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714504934; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cHrHHVziKqHClfZx1hLXMMvTnz8UXqFmBvBknMO0s5g=; b=Cbb+d9Fri20fyynu02W5k0cuOUeDbHvCMu+m9EZNs5OK332wUnERexAIdAHDnsLkTk0d15 Y34UAGi1cV++3zPlG9A/2yBy3uOi4HQG6irkXP9/Eye3mjPtlARbCJRLP8gg8y68WusvtH QWx3iPrlDoxXLI7yU3EZJ+pn4K+srM4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-358-tsDAZSAaNLmZPS_Py6ObCw-1; Tue, 30 Apr 2024 15:22:12 -0400 X-MC-Unique: tsDAZSAaNLmZPS_Py6ObCw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 31D2A830D37 for ; Tue, 30 Apr 2024 19:22:12 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E945CEC681; Tue, 30 Apr 2024 19:22:11 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 43UJMAkO3086174 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 30 Apr 2024 21:22:10 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 43UJMA1F3086173; Tue, 30 Apr 2024 21:22:10 +0200 Date: Tue, 30 Apr 2024 21:22:09 +0200 From: Jakub Jelinek To: Jason Merrill Cc: Aldy Hernandez , GCC Mailing List , "MacLeod, Andrew" Subject: Re: 1.76% performance loss in VRP due to inlining Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Apr 30, 2024 at 03:09:51PM -0400, Jason Merrill via Gcc wrote: > On Fri, Apr 26, 2024 at 5:44 AM Aldy Hernandez via Gcc wrote: > > > > In implementing prange (pointer ranges), I have found a 1.74% slowdown > > in VRP, even without any code path actually using the code. I have > > tracked this down to irange::get_bitmask() being compiled differently > > with and without the bare bones patch. With the patch, > > irange::get_bitmask() has a lot of code inlined into it, particularly > > get_bitmask_from_range() and consequently the wide_int_storage code. > ... > > +static irange_bitmask > > +get_bitmask_from_range (tree type, > > + const wide_int &min, const wide_int &max) > ... > > -irange_bitmask > > -irange::get_bitmask_from_range () const > > My guess is that this is the relevant change: the old function has > external linkage, and is therefore interposable, which inhibits > inlining. The new function has internal linkage, which allows > inlining. Even when a function is exported, when not compiled with -fpic/-fPIC if we know the function is defined in current TU, it can't be interposed, Try int foo (int x) { return x + 1; } int bar (int x, int y) { return foo (x) + foo (y); } with -O2 -fpic -fno-semantic-interposition vs. -O2 -fpic vs. -O2 -fpie vs. -O2. > Relatedly, I wonder if we want to build GCC with -fno-semantic-interposition? It could be useful just for libgccjit. And not sure if libgccjit users don't want to interpose something. Jakub