From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bee.birch.relay.mailchannels.net (bee.birch.relay.mailchannels.net [23.83.209.14]) by sourceware.org (Postfix) with ESMTPS id B7FF83858037 for ; Thu, 11 Nov 2021 19:41:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B7FF83858037 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.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 A987E362946; Thu, 11 Nov 2021 19:41:27 +0000 (UTC) Received: from pdx1-sub0-mail-a304.dreamhost.com (100-96-18-151.trex.outbound.svc.cluster.local [100.96.18.151]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 441DB362032; Thu, 11 Nov 2021 19:41:27 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a304.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.96.18.151 (trex/6.4.3); Thu, 11 Nov 2021 19:41:27 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Madly-Blushing: 4e0c667b57f12642_1636659687502_1120442614 X-MC-Loop-Signature: 1636659687502:534623732 X-MC-Ingress-Time: 1636659687501 Received: from rhbox.redhat.com (unknown [1.186.121.107]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a304.dreamhost.com (Postfix) with ESMTPSA id 4HqsXj3gPPz2Y; Thu, 11 Nov 2021 11:41:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gotplt.org; s=gotplt.org; t=1636659687; bh=YKwBjtXWl3jFd/7Rr2mCITJelLU=; h=From:To:Cc:Subject:Date:Content-Transfer-Encoding; b=Ip9WT47nP4u4VcYm205TFPluKKpAz1Wmfg4NseablmVPWo3YTHQz/EajQ1dptNIE3 pXmbK4XtCiJAs4dCjK0J+y0ZESYwQ90clMfFMvdd/CQJqBZ8UcWqlgmi7JrBK8LLEk vtUc8YEpRny/hNDkTTd5Kun0JwKvTd+uN1MbJPKQ= From: Siddhesh Poyarekar To: gcc-patches@gcc.gnu.org Subject: [PATCH 0/3] gimple-fold improvements Date: Fri, 12 Nov 2021 01:11:13 +0530 Message-Id: <20211111194116.1626980-1-siddhesh@gotplt.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Nov 2021 19:41:32 -0000 This patchset improves folding in cases where input lengths and/or destination sizes may not be constant but are range bound. Tested on x86_64 with a full bootstrap build and verified that there are no regressions resulting from this patchset. Also tested a build of bash, which results in 3 __memcpy_chk calls being optimized away completely in addition to a couple of memmove and strcpy chk variants being transformed into regular calls. Siddhesh Poyarekar (3): gimple-fold: Transform stp*cpy_chk to str*cpy directly gimple-fold: Use ranges to simplify _chk calls gimple-fold: Use ranges to simplify strncat and snprintf gcc/gimple-fold.c | 312 +++++++++--------------- gcc/testsuite/gcc.dg/Wobjsize-1.c | 5 +- gcc/testsuite/gcc.dg/fold-stringops-1.c | 23 ++ gcc/testsuite/gcc.dg/fold-stringops-2.c | 63 +++++ gcc/testsuite/gcc.dg/fold-stringops-3.c | 18 ++ 5 files changed, 220 insertions(+), 201 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/fold-stringops-1.c create mode 100644 gcc/testsuite/gcc.dg/fold-stringops-2.c create mode 100644 gcc/testsuite/gcc.dg/fold-stringops-3.c -- 2.31.1