From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id 6AF543858D35 for ; Tue, 30 Apr 2024 07:58:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AF543858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6AF543858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::230 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714463890; cv=none; b=xZDFmTDpOk/VA4Wa9SZ+tzAG+20xQqqOUCQ8CwgzcmA0f9uUno8mxjKGG10xhi0fEx1ig2HGhDWCmXR07nK8mfvxKnDr7H0Fjt9eMkVoXeYBluoo70X/87f/+AcSAqSE3JzVegh2lp0jNgE4TabXsMS1igq7Ds2TE/gTdICNRDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714463890; c=relaxed/simple; bh=GbXTZeIni/Ncrj9LvbbbB2PxRz3UCPzURDFPhK3ntIE=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=KAU5pe0s8dU/M70HZe35+eOAaQKQTjVjYoi/khvklH4yiMxDlOtsmXuX575+7fcbA3dOfdaAqWko2XMDFp5YkHe7iX5JgIGvjNT7dh5C3qSkaZTwWYUj3fJZTSEu/RDno4TzDVBRi6413+xgfLCTB198EyiyH/bZFh/Nfs8nmnQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2d8b2389e73so64425081fa.3 for ; Tue, 30 Apr 2024 00:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714463886; x=1715068686; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JUgBClvbFr2edXvfAx0cVcxWcGnAcFm9CTjbQjKmUys=; b=henCoDqwSwoqnr9x3W5nLI9eNBIn68KEGlNaD29hCByy8WnIn5rdy2EoHUekAa1pXf P2/QcxbrPUDnrSNNg+SlXHAp7wVFN50Yxb0uvyfebNWqExqP498JsJuyk0eqieSFGFg8 jkeJVYISuSw5y4KJYMZSOAz+Qbi2iT1jeg0flPHJOhxt323aBTRpiUzta2niUasVVRq/ KtTzrUTHFs/pOxLFzBvuy+Hm82sU6bVx/Idh5SyTicoidBgJLdyfB9+8K8GIekFOzSfA Y/m+Jjcx3f4oXIkfqJIWM0XCfCS6QUQQd1BwCz0K09mUjBwlWBpAicxyNG/kRiEveZHr brWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714463886; x=1715068686; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JUgBClvbFr2edXvfAx0cVcxWcGnAcFm9CTjbQjKmUys=; b=Yc7sgrKDdDe2rRj1NvVWL62vBXXZO7ifcmLsrz/hUaos57gPHBRG/isMebQadjcyrK OVBJ1pnE2GixbqZoxySp0G9Nu4dnQ8GuzyDPbZV6sT1JDcpiVu/UBLoPVT/MgxcFCQlb VorJ+pPFPJO9O/TYhP6QoKvoGl0G6nuLtUaVuRxVxnCvEuR+cX3bCeVPUfY//H1AZ/0v Mr7QSJ/OTZ9BhECFhgLuTNFXPaIA5ofJFy5eJ02kHfNG//vmzzEDnW8C3T/Cb65e6ks2 1BuHU6+Ed7DyxLbTChKBUOe0uxVR/z8yEjMriRikJ8wtvr36dBFTTPuG1GcqgSKd6J2v fT+Q== X-Gm-Message-State: AOJu0YzrKKAkFDB8CI0zhT26tmAN+eXZIXR/Fsr3B1WmUKPDYPeFfFUF LGvKE9kCwI0uL2HISVOBgpesg/Ge050Ec767ZYaThTLe/2GXr2fjcu9NoW4936s7oKB4pwd2tif 4pSjJg6B2POyenAXF5t7agRSp0nLyZQ== X-Google-Smtp-Source: AGHT+IGu98KPxm6gUvXP273yZZ1QqOKKpgC41GBYZqVEj63qQcPKzWjlE8afSQFyUX9Uxjz2zZmZDEdo76q2my0ZbPE= X-Received: by 2002:a2e:9c85:0:b0:2dc:b467:cb35 with SMTP id x5-20020a2e9c85000000b002dcb467cb35mr1286678lji.32.1714463886122; Tue, 30 Apr 2024 00:58:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Tue, 30 Apr 2024 09:57:55 +0200 Message-ID: Subject: Re: 1.76% performance loss in VRP due to inlining To: Aldy Hernandez Cc: GCC Mailing List , "MacLeod, Andrew" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Fri, Apr 26, 2024 at 11:45=E2=80=AFAM Aldy Hernandez via Gcc wrote: > > Hi folks! > > 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. > > I don't know whether this is expected behavior, and if it is, how to > mitigate it. I have tried declaring get_bitmask_from_range() inline, > but that didn't help. OTOH, using __attribute__((always_inline)) > helps a bit, but not entirely. What does help is inlining > irange::get_bitmask() entirely, but that seems like a big hammer. You can use -Winline to see why we don't inline an inline declared function. I would guess the unit-growth limit kicks in? Did you check a release checking compiler? That might still inline things. > The overall slowdown in compilation is 0.26%, because VRP is a > relatively fast pass, but a measurable pass slowdown is something we'd > like to avoid. > > What's the recommended approach here? > > For the curious, I am attaching before and after copies of > value-range.s. I am also attaching the two patches needed to > reproduce the problem on mainline. The first patch is merely setup. > It is the second patch that exhibits the problem. Notice there are no > uses of prange yet. > > Thanks. > Aldy