From patchwork Fri Jun 23 14:48:47 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: 112185 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5827343vqr; Fri, 23 Jun 2023 07:49:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Yuwb6IzctqQm2qQSbKw/S/aEPeQYHE/bEXaPIrk1iljvpuiv/IpXrF5/ZId5xT37+Rsyt X-Received: by 2002:a17:907:6090:b0:988:93fb:2e94 with SMTP id ht16-20020a170907609000b0098893fb2e94mr16692055ejc.27.1687531769055; Fri, 23 Jun 2023 07:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687531769; cv=none; d=google.com; s=arc-20160816; b=Y/f6FXlWZJqAFIe6vstkBvLOR5YvP4VxBfJOJmJfQ4UEQIkz9WcujdaOptvdRNnCZ8 sco0JNzPDbsV16M2EnEHWV65+mBODMg8kNg1DyVxNrouarKojFQ1EnE9KBRQvapmEN6V H/+zML5ePKIg9j86Ed0kepKupqNkX0YR+oC7Ql6n0eOxBgvJEjU17QMt0cStAux3Ty0p hosendAhC0CIruXemthMl5kYaOZRoD4GlkVR+RhyQbdRI9UWjzEU2TTOqv9sE/CXW/ZD sKAkz4qoZuijHQUEn9o66Mcq/PNly/PuYHNN3omgEEHgth7V4UITr4ko6BBVhT3JYDQe QKeA== 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=gWdSArC1nmxV18f6/8MyQwMaGUExAetYxEKf8TeqYdc=; b=X1+AlTr42iY9qei3odrW4KFrgTJbOrgIW8mO3Or4Y0fZ037FJ4R3uqzaU747VH3E3J ujMjq0PrAt2c6+z1wr2eQAx1++/tyaYOZ6tQMlrrZcVUFyYPkS8CGfOoInmVSAXXJuJg Bi610KeTjf5sMgKPHfjGJ+NicjVjmBAJtTes+gpEizsZXCfrTQnV9SKk42JUfHr9+99h /cFc7WmdhvgvNtK3Z46c/5bq1Tivqinp2fvFIpZMpeYyu/llwZ9crgIHq5Bh8ifWLV0w amNNJCTTOjZhdvaBI6B8I/6cpgJpc+lRNdYMz8tG2Rr+cNQLjt3ZMVPvMhW/47Jg4Q+Q AXbQ== ARC-Authentication-Results: i=1; mx.google.com; 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" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d5-20020a170906344500b0098ad2c36e5fsi3406960ejb.883.2023.06.23.07.49.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 07:49:29 -0700 (PDT) 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; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 197113857729 for ; Fri, 23 Jun 2023 14:49:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtpbg150.qq.com (smtpbg150.qq.com [18.132.163.193]) by sourceware.org (Postfix) with ESMTPS id E441C3858CD1 for ; Fri, 23 Jun 2023 14:48:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E441C3858CD1 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: bizesmtp63t1687531730t7b2ziw6 Received: from rios-cad5.localdomain ( [58.60.1.11]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 23 Jun 2023 22:48:48 +0800 (CST) X-QQ-SSF: 01400000000000G0S000000A0000000 X-QQ-FEAT: IcCSTr/hHjOk7Zk2ohD8XRTC4r3tFVljbviRi/QL2glVv4OMIwR/OR47OOSjR MhsJcYTMpvEAcvPGrEfAO5feBEJwI+GyeMQvqZu+2u48LhE4r9tbIz8FzgRqydlyvlNUTpe oQ2uBanBsvYIuOPoy9TGN3X6bn2LmqqiyekEuqq1v+Hau/GOeIrI6zOVgLHDidzadLzjl0s f9ZKpS2QNvASPZiwQM8/4Uocukxvj1Gj5kRdy6APozgHj1rNCEAmfHpddJNO7p9j5CnFicR ppeWI8A5cfkMgV+5Yu4km2QQxzSaNGU0CskuXEIkwf0BNLvfBU+m7CkgNYrMZrsG5n0jNb8 RO6kZUhQkLToovq7ZjNeto9iL24J1qywci6jYrC6dRSUej4P8Cv0Hbp6efx0GYFRilaI14G X-QQ-GoodBg: 2 X-BIZMAIL-ID: 6923849870850632596 From: juzhe.zhong@rivai.ai To: gcc-patches@gcc.gnu.org Cc: rguenther@suse.de, richard.sandiford@arm.com, Ju-Zhe Zhong Subject: [PATCH] DSE: Add LEN_MASK_STORE analysis into DSE Date: Fri, 23 Jun 2023 22:48:47 +0800 Message-Id: <20230623144847.85698-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.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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?1769505312538536177?= X-GMAIL-MSGID: =?utf-8?q?1769505312538536177?= From: Ju-Zhe Zhong gcc/ChangeLog: * tree-ssa-dse.cc (initialize_ao_ref_for_dse): Add LEN_MASK_STORE. (dse_optimize_stmt): Ditto. --- gcc/tree-ssa-dse.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gcc/tree-ssa-dse.cc b/gcc/tree-ssa-dse.cc index 3c7a2e9992d..01b0951f1a9 100644 --- a/gcc/tree-ssa-dse.cc +++ b/gcc/tree-ssa-dse.cc @@ -174,6 +174,23 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write, bool may_def_ok = false) return true; } break; + case IFN_LEN_MASK_STORE: { + /* We cannot initialize a must-def ao_ref (in all cases) but we + can provide a may-def variant. */ + if (may_def_ok) + { + tree len_size + = int_const_binop (MINUS_EXPR, gimple_call_arg (stmt, 2), + gimple_call_arg (stmt, 5)); + tree mask_size + = TYPE_SIZE_UNIT (TREE_TYPE (gimple_call_arg (stmt, 4))); + tree size = int_const_binop (MAX_EXPR, len_size, mask_size); + ao_ref_init_from_ptr_and_size (write, gimple_call_arg (stmt, 0), + size); + return true; + } + break; + } default:; } } @@ -1502,6 +1519,7 @@ dse_optimize_stmt (function *fun, gimple_stmt_iterator *gsi, sbitmap live_bytes) { case IFN_LEN_STORE: case IFN_MASK_STORE: + case IFN_LEN_MASK_STORE: { enum dse_store_status store_status; store_status = dse_classify_store (&ref, stmt, false, live_bytes);