From patchwork Mon Jun 26 02:37:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "juzhe.zhong@rivai.ai" X-Patchwork-Id: 112704 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7204387vqr; Sun, 25 Jun 2023 19:38:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7+J9KLKu1HuznVqdDU2GhkkKYAjhzt3P3tJq6sYQx/AuywR2+TT7gYWJdjvcbr+QmYo94e X-Received: by 2002:a17:907:d0f:b0:975:942e:81e7 with SMTP id gn15-20020a1709070d0f00b00975942e81e7mr26936581ejc.37.1687747093526; Sun, 25 Jun 2023 19:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687747093; cv=none; d=google.com; s=arc-20160816; b=rDMM69D2kp038ksTck7JwnUfeufQpBvqi80AUcHWaruv+v4RiDwEPmnKK8Zqd7A7DE CVIIpP1Xth8Vm3XTeUERrAx7cAp3BkqPdE8ahBAOvVYM9KlZ3FJx9tfS2r/s8ynpKwB/ fElzHWHkkFSiA+0tCODz7Zwyj0MVTfZEFzHTIqwI4sLtGP/JXIEBmkFD9ygajiiIZSK/ uru2WSCjBX8FAyaKXl1tUk2TrPZEujKSr2yGdS5hHp6d/PDDHofq8bUzT0ANA/GIgARE i/brxoiQtTW0az4PKC82pT1YJwA27rlJ6yvvDLf81xvQXG4WiowkUoVEzxW8M5nwY5J4 Hz8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dmarc-filter:delivered-to; bh=akl4dMvKIbkEIQfgTHC7iADnodGl6eYDTm5nIa6w7MM=; fh=h6UG6PIw2FD/e8JL+9n/VDDoO75bXx4B3jGj5okR2Rw=; b=J+HtVtbMWL/FAw52z7PAMZt6442hiTSWfCqwdaVroyjRjpCAu+MOg+MxrRhT6UpD92 4nVm2YVVaNQX/aLIWAUq4HkPP4x4Ga+9gVYoLuzW2pm/URBfHKWVGHup/rv+SAC/soby UbvTEce6la4/7j7FmLUTn3cmquOnkLdVMEuKEeYlH+7EXiqcJHndxTzjAEwQo12fP/OA aBhc616NJ8FvI1DF2JkV+oiYiqdRfvjUF2jRlBs3FJ7NeFid7/76rvwgoL8hOZzF7EAn JxvLo3EZHnfbaatmd59bMERlkLYujLPWcUdg9+m2j7BWcyXiuDGtIoG0W+rDJgCOovmV Km9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ce7-20020a170906b24700b0098e0001c6f7si1942143ejb.735.2023.06.25.19.38.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 19:38:13 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CF22E3857BB2 for ; Mon, 26 Jun 2023 02:38:08 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbg154.qq.com (smtpbg154.qq.com [15.184.224.54]) by sourceware.org (Postfix) with ESMTPS id C38233858D20 for ; Mon, 26 Jun 2023 02:37:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C38233858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai X-QQ-mid: bizesmtp84t1687747057t20kn1m5 Received: from rios-cad5.localdomain ( [58.60.1.11]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 26 Jun 2023 10:37:36 +0800 (CST) X-QQ-SSF: 01400000000000G0S000000A0000000 X-QQ-FEAT: hvKw+PyJ8U65ot1zqdVxhhby353neXhHO+0p9jAxZR9Vr8+0KXBi0vxLlZyB3 9yGZJTb0yrPkT7wnU8djpgKVRZAiIVWFAvz9V1KlZqYEJ6flwC+c9R2rPlrFvtuQy1v1axa Mzj08OIDM2B704YOc3EcNSz5ZVL2Y+xSo709YiORs4EtsZN2brqdd39h0msF0UyLkbw0hS7 Y6CVyafqr6m5UQmsl0Dyk7XIu72rnTIxZXy818Bsd5EbebBtPJzb7Wsf7edgw69+Xm15A42 lv8NDKNB9F65BEuzv9QZZW3JNHeDgzieSaQjc7c3Uvcb/lQ34M7rBs+d32ah4QQ4BkM1Ros fIZqC7Gep/iSfTwBW9BZ2lAROnFIhzI2+u/XvbhXT0s15PAvCBJ78ToDh2BWV3Pz50K8xx5 X-QQ-GoodBg: 2 X-BIZMAIL-ID: 56999897669688561 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Cc: richard.sandiford@arm.com, rguenther@suse.de, Ju-Zhe Zhong Subject: [PATCH] SSCV: Add LEN_MASK_STORE into SCCVN Date: Mon, 26 Jun 2023 10:37:35 +0800 Message-Id: <20230626023735.1013441-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , 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?1769731096584199723?= X-GMAIL-MSGID: =?utf-8?q?1769731096584199723?= From: Ju-Zhe Zhong Hi, this patch is to add LEN_MASK_STORE into SCCVN. LEN_MASK_STORE is predicated by both len and mask together. My understanding is that LEN_MASK_STORE has same rhs_off and offset as MASK_STORE. The size = MIN (length (deduced from mask), (len + bias)). Not sure my understanding it correct or no. Hope experts (both Richard && Richi) can correct me if I am wrong. Thanks. gcc/ChangeLog: * tree-ssa-sccvn.cc (vn_reference_lookup_3): Add LEN_MASK_STORE. --- gcc/tree-ssa-sccvn.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 11061a374a2..d1629800705 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -3304,6 +3304,16 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias)) return (void *)-1; break; + case IFN_LEN_MASK_STORE: + len = gimple_call_arg (call, 2); + bias = gimple_call_arg (call, 5); + if (!tree_fits_uhwi_p (len) || !tree_fits_shwi_p (bias)) + return (void *)-1; + mask = gimple_call_arg (call, internal_fn_mask_index (fn)); + mask = vn_valueize (mask); + if (TREE_CODE (mask) != VECTOR_CST) + return (void *)-1; + break; default: return (void *)-1; } @@ -3379,6 +3389,13 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, pd.rhs_off = start; pd.offset = offset2i + start; pd.size = length; + if (fn == IFN_LEN_MASK_STORE) + { + HOST_WIDE_INT len_bitsize + = (tree_to_uhwi (len) + tree_to_shwi (bias)) + * BITS_PER_UNIT; + pd.size = length > len_bitsize ? length : len_bitsize; + } if (ranges_known_overlap_p (offset, maxsize, pd.offset, pd.size)) return data->push_partial_def (pd, set, set,