From patchwork Tue Feb 28 13:47:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 62493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3022094wrd; Tue, 28 Feb 2023 05:48:39 -0800 (PST) X-Google-Smtp-Source: AK7set8YYQ2C0ffutCk49oSDSzQqDbG/+yJ0itSEVrTFBfP839VmLfkdvj5JwwAjronFC4PDWCVB X-Received: by 2002:a05:6402:419:b0:4af:62ad:160b with SMTP id q25-20020a056402041900b004af62ad160bmr3743775edv.5.1677592119359; Tue, 28 Feb 2023 05:48:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677592119; cv=none; d=google.com; s=arc-20160816; b=GOKs/y0txyaDL9BQF6+uVJkjFFSQh+MfBdJRyd2VQZDaFqLLgIPgm+6cqxmEZsmH2x pM9hP9/lRHPd9lFtiWBdjIgr08m/whb8Q/32U/iDH0qBvihlcgxZO6eSe8fCjv3iO/xe ZhoM2pnKuqI1YppS0AqBu4R2sjdn29h34e9Uw4ltzEY++4aSyOxK2wMTZsZZ37lboGfq x5FVnstlI8YooSkMONj//hfbJRkrycWuPHn/i+ONswjGauP3sERPvJmxcMBHiPPkQoGj +U4lHCkoRsyrLUKSnQBxpVrP8bEVJvsb+qqvVq3QseEZjPU54us7d+HMsTYBEIRS1jOC mSPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:message-id :mime-version:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=LpvetY519uz/HHB8RmzZ147SAWhX+nSEiGL7BFbyYoU=; b=BGh5/OIbhpswzkz02M0xzrx5/3aG7K2SMc4GwtKOxcPlFIi6SN1OFXCaIeIu8lNUBZ 3qbJaNCLRJdTJTt49bandzabcwXGMauf2IH7Stxd9FeAWGz3Do/0wLYmIeuuIiEN9oOU NT+5BUVoZaFmSqaHjilfqnvNAdfXAYvm+r7DXAqHcZDilzeHIas98J05iQe4ZGSy07Ge RpDBhg02RLzlXL+uWkdubVCRx1U7l23POsMCZMpHRjMOF+aoi+ZAferozG3qBsNMbTLq ipMHG/8QqHCjixhq+BnZVLSH5zezaQPv62M29SkG3hvsLdH/XXFyzuCvjvchkr8gD8UP rQaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="a/pQ0L5B"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l9-20020aa7c309000000b004acb4614ed5si10747365edq.117.2023.02.28.05.48.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 05:48:39 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="a/pQ0L5B"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 68472385021A for ; Tue, 28 Feb 2023 13:48:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68472385021A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677592090; bh=LpvetY519uz/HHB8RmzZ147SAWhX+nSEiGL7BFbyYoU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=a/pQ0L5BX61cITK6Tvt+kjZAeRfGuYgfA/ztrYHZlXnIvKO3aQpMi0KlcAolBjVIO jgd/JsyyGfM/6jvd7k6TiW6x9KRQCUO3Y0et1YKa7in37Sm32Bp/Pq0I22nnpzwga2 Z5PW5CpD8wYHcr2IFlJLdCwRXb19Tb/FaOsB3Jb0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id D255F38582B0 for ; Tue, 28 Feb 2023 13:47:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D255F38582B0 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 17D2E1FDC1 for ; Tue, 28 Feb 2023 13:47:25 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 02E8813440 for ; Tue, 28 Feb 2023 13:47:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Rub5OuwF/mMnPwAAMHmgww (envelope-from ) for ; Tue, 28 Feb 2023 13:47:24 +0000 Date: Tue, 28 Feb 2023 14:47:24 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/5] fend off anti-ranges from value-range-storage MIME-Version: 1.0 Message-Id: <20230228134725.02E8813440@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759082834117810618?= X-GMAIL-MSGID: =?utf-8?q?1759082834117810618?= The following avoids the need to special-case storage requirement and copying for irange_storage_slot by making sure we canonicalize such ranges to int_range<2>. * tree-ssanames.cc (range_info_set_range): If receiving an anti-range recurse with a temporary int_range<2>. * value-range-storage.cc (irange_storage_slot::size): Assert we're not asking for a VR_ANTI_RANGE. --- gcc/tree-ssanames.cc | 3 +++ gcc/value-range-storage.cc | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc index 08aa166ef17..23468958586 100644 --- a/gcc/tree-ssanames.cc +++ b/gcc/tree-ssanames.cc @@ -127,6 +127,9 @@ range_info_get_range (tree name, vrange &r) inline bool range_info_set_range (tree name, const vrange &r) { + if (r.kind () == VR_ANTI_RANGE) + return range_info_set_range (name, int_range<2> (as_a (r))); + if (!range_info_p (name) || !range_info_fits_p (name, r)) { if (range_info_p (name)) diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc index bf23f6dd476..79ab2921a03 100644 --- a/gcc/value-range-storage.cc +++ b/gcc/value-range-storage.cc @@ -182,7 +182,7 @@ irange_storage_slot::get_irange (irange &r, tree type) const size_t irange_storage_slot::size (const irange &r) { - gcc_checking_assert (!r.undefined_p ()); + gcc_checking_assert (!r.undefined_p () && r.kind () != VR_ANTI_RANGE); unsigned prec = TYPE_PRECISION (r.type ()); unsigned n = num_wide_ints_needed (r);