From patchwork Fri Sep 20 16:40:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 57468 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9807385DDC4 for ; Fri, 20 Sep 2024 16:41:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rusty.tulip.relay.mailchannels.net (rusty.tulip.relay.mailchannels.net [23.83.218.252]) by sourceware.org (Postfix) with ESMTPS id DD17C3858D39; Fri, 20 Sep 2024 16:40:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD17C3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DD17C3858D39 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=23.83.218.252 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1726850449; cv=pass; b=xaSWvvVdHz1uKIMT2agGehHoJF4Ofnjdguy5m302bd4xAtnD/zH4KMXh+1qwascnuyWQO9xUrP7ydplWEMy53/uDkpxf0PDwDYPUPduwvM9GxsawXHTh1FGeph0L4OsZvgdquVIzsdtciyNWx+aKWGEL69I6mMxrAAvi66A86+Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1726850449; c=relaxed/simple; bh=KmDJdIFy1RBKkf9wMSm6kgn7WoAsgVAkl8Vfp0BBKGs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HyKV9v3eVwbQpyZ6Jkt6HAfRRZ9cv+GLe9qJuKUQ6qR1fg07EgZlvrhlkWwhjOdYaLQEVC3MUC3NxR45GBjYik7r1PiLtoSXTczeLW74r2OWG+eJPLuJhH1xoszO0YchWXUSfyyIeuZpEilYeMyvK09ObfuBiX+vdtvGlQPtKgg= ARC-Authentication-Results: i=2; server2.sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id DDFEB8A64B5; Fri, 20 Sep 2024 16:40:45 +0000 (UTC) Received: from pdx1-sub0-mail-a312.dreamhost.com (100-99-103-236.trex-nlb.outbound.svc.cluster.local [100.99.103.236]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 84DF28A48E4; Fri, 20 Sep 2024 16:40:45 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1726850445; a=rsa-sha256; cv=none; b=mhn9PS/bMQh8GhBUNPLAFRVCoOGmXLPvBSppDPzwP0KQtr9aS/KAsbtej+9jXeJNHzhHMu 1ziEPGKoe0Ercb/AErnV16FymwE87gRg7Ceash8QNK9pXXQS3IhZazhmZ9z1vEfkv24FJ1 i3uOshH8dZ9zOu495WWnLR1FcVjLhedeBa3iLLjs2vozV+GhBAB3tfSWELHjjkH2MKTuis WwwQ7liBE2buAlixZrW/kd+P0BjI3w4379pksY7+eIfG6uDwlx6gfEF5aIcyBtShGWfChM oO29UoL8QbWLcNb1iEZ0CmNbNgToABBLs3L0wl9ZVzy2l+yedubbDqpP3p96Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1726850445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yXAYq4tyjqVXf9TS6MIwAufiH2+1IVGfBQHlJYR36Ow=; b=tSJrDLM6SIvrttdtXEMmhpECmGC6ysKJ/4bZ4efUpbP9KitgxIj990RLE/q7J3PWgBDq7N SKMV2a3UOHPHl1SX7oZHK+IYc8A6b2RFUqOP/DE6Vly9h7Oy8+zQQ6gqmIeHPMjQe5fuXP bS9U3nUGqi14xIMte7HZ+/BrmUMNGmZvnxUdebUDfYI7IypuzhVfjR9/0i1UGxmmu1gqnC SNd/618ZeJP7bpgi3tyZnB71BIE0wwcQgJ6Dr6NR2wvuO6Si/u2E+pgoGCeKTongOLc7Dy le2Uc9gVHXVwNwO1szGNLJEPBzNUR2KCwL/qwuORmsBC0jNpduUIZ9tNLLFtMg== ARC-Authentication-Results: i=1; rspamd-5b46bcd97f-svd8d; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Occur-Sponge: 3f2cf6d14e4fc4d6_1726850445754_1127568495 X-MC-Loop-Signature: 1726850445754:3737059916 X-MC-Ingress-Time: 1726850445754 Received: from pdx1-sub0-mail-a312.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.99.103.236 (trex/7.0.2); Fri, 20 Sep 2024 16:40:45 +0000 Received: from fedora.redhat.com (bras-base-toroon4859w-grc-66-76-71-1-128.dsl.bell.ca [76.71.1.128]) (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) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a312.dreamhost.com (Postfix) with ESMTPSA id 4X9J6P19PfzS4; Fri, 20 Sep 2024 09:40:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1726850445; bh=yXAYq4tyjqVXf9TS6MIwAufiH2+1IVGfBQHlJYR36Ow=; h=From:To:Cc:Subject:Date:Content-Transfer-Encoding; b=bhXihIu9aLY1uff3lX8aZhg3ecrIlpvcZRPEqte0puDdd3ue5LLDYXpCbtcCoh9jD mMuCqPbUvQxkc/jIRwTpeuE9xPdMDkz85ntqvS1y1YXm6easO2w758gGa7wiNONbwG +/QziexiUSdtfuVIyc8Qq56yVamF7E4tqKyC6U/FxLfsVUsPFLsPsuXV8fzrJFTB0T 9D6aFrg70hAIYbVus1k8PnRcQXrdMdqBOYgTasQg4agA9QGHOhsVz+aW9itnZXKSQw ULpPuf4qLz/HoNIjw7QtrYd4S5XfjpyCqICzxxSL+BSsgnVw9nA+nmH+XM53n2VeBo Jyo+vYE9es1Wg== From: Siddhesh Poyarekar To: gcc-patches@gcc.gnu.org Cc: pinskia@gcc.gnu.org Subject: [PATCH v2 0/4] tree-object-size: Improved offset handling Date: Fri, 20 Sep 2024 12:40:25 -0400 Message-ID: <20240920164029.63843-1-siddhesh@gotplt.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240914123049.2746225-1-siddhesh@gotplt.org> References: <20240914123049.2746225-1-siddhesh@gotplt.org> MIME-Version: 1.0 X-Spam-Status: No, score=-3030.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org This series makes a few improvements to get static object size estimates in more cases, thus improving the success rate of the static __builtin_object_size. This should fully fix PR116556 and also covers a bulk of use cases for PR77608. I started to try and fix PR77608 fully, but in the end it looks like too much work in the pass for what seems like a very small set of uses, i.e. handling volatile offsets. If that is a desirable end goal then it could be done in a separate patchset since it will need tree-object-size to handle trees with side-effects. Testing: - x86_64 bootstrap and make-check did not introduce any new regressions - i686 build and make-check did not introduce any new regressions - Bootstrap build with bootstrap-ubsan config succeeded. Thanks, Sid Siddhesh Poyarekar (4): tree-object-size: use size_for_offset in more cases tree-object-size: Fold PHI node offsets with constants [PR116556] tree-object-size: Handle PHI + CST type offsets tree-object-size: Fall back to wholesize for non-const offset gcc/testsuite/gcc.dg/builtin-object-size-1.c | 102 +++++++++++++++++++ gcc/testsuite/gcc.dg/builtin-object-size-3.c | 89 +++++++++++++++- gcc/testsuite/gcc.dg/builtin-object-size-4.c | 6 +- gcc/tree-object-size.cc | 101 +++++++++++++++++- 4 files changed, 289 insertions(+), 9 deletions(-)