From patchwork Wed Jun 21 11:30:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 110987 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4291215vqr; Wed, 21 Jun 2023 04:32:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ41AN2hyiYx3Gp9ruhJEmk/puaj/ANZcfq3WTd0/FnmFsMOqMILHDSb1gncuvRUPWDTCTyj X-Received: by 2002:aa7:c393:0:b0:51a:44b3:ab82 with SMTP id k19-20020aa7c393000000b0051a44b3ab82mr8127323edq.38.1687347121201; Wed, 21 Jun 2023 04:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687347121; cv=none; d=google.com; s=arc-20160816; b=0544NGBAHxdE/CXW81BkBSVd7lc9MbckgjawNmEkX+z3/G6Rs7w1H47ynciGqtog0U Fau1htRPmVF/0cGngSwvLh5JyyMmuAc2ETFqA41kECVxOE7w36DRzIMun1s7lDsIrF9p phMP4lCYsx6RgA/sSIcGAyTUszeIIpVec9LiG+5+K4m85q4LIBbm75HeHZxlKRBHJtqk 5KKgpd9NKAlz7jlEljbwce9ylUSNsTajBJyQCqGW+R9VffmtFiTwyu3VItHMFs5n+X1/ +UnjShopxn/NgRic1ZNiMV7Bax2rryiEg0TDRJWkv+YUTcJ7Tzi3EMalzvmetESFIZaQ gpIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=xPI//QizCwQYv7s7J/qUOOmqy4o8x1q1FdtFH7jeNqY=; b=R0eKaQXEHPIM+lgvJhInpmd3DtH8c+wpBkV9ZECdPFS8t3y1+y5xOafa+N4x/l1WRM TN4rCp3KdgFpL88D4agY37B5yAvcsoJBDFWn9ePPtfzZagOApHgQzzFAbE3JSTdhgR3j RgaQuuieoy4DDccUPUAM9NeODuokXX6P/cIr6xwUgzBO9G7vx/60Q3Ga4KWXaFoh7xt9 vPrkxk1G4SlVDJf41fHnKgUo/siS5BJbfFxalBcsP+ALVc8MMW2dfUrXn8C/tKtM5nZM V5b8yHAVNePKerU5RpwTcypCiSV8GS9H/JEkYbYYufUcQISoFrkF7LjUcnJjwqCbwhm2 EqsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WfX+GmeD; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id f8-20020a05640214c800b0051879c1c261si2067419edx.257.2023.06.21.04.32.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 04:32:01 -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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WfX+GmeD; 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"; 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 909183856DF1 for ; Wed, 21 Jun 2023 11:31:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 909183856DF1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687347101; bh=xPI//QizCwQYv7s7J/qUOOmqy4o8x1q1FdtFH7jeNqY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WfX+GmeDY7gzPpSFjG+IvWhdUKT4Ih771KNG4VmAisEfaIzsxUwNfCXC4dbu0pd8w IXDM+Im3cKNGNgUy1V8avrMW2SgaBHWcd+mx61Krkj9MSeLzHhz8sA3kbUpJW6Z4WW ARFYKDTvo4KYoTuGGY+rfZ7+vG/r4kKarww6wrf8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id BD0353858D28 for ; Wed, 21 Jun 2023 11:30:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BD0353858D28 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id EB19D21BE2 for ; Wed, 21 Jun 2023 11:30:54 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id DAA8D2C141 for ; Wed, 21 Jun 2023 11:30:54 +0000 (UTC) Date: Wed, 21 Jun 2023 11:30:54 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/3] Hide and refactor IVOPTs strip_offset User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, 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: , 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" Message-Id: <20230621113141.909183856DF1@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769311695251542895?= X-GMAIL-MSGID: =?utf-8?q?1769311695251542895?= PR110243 shows strip_offset has some correctness issues, the following avoids using it from loop distribution which can use the more correct split_constant_offset from data-ref analysis instead. The patch then un-exports the function and refactors it to make it obvious the actual constant offset is only interesting in address-cases. The series is split, removing one strip_offset at a time for easier bisecting of code generation quality issues. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-loop-distribution.cc (classify_builtin_st): Use split_constant_offset. * tree-ssa-loop-ivopts.h (strip_offset): Remove. * tree-ssa-loop-ivopts.cc (strip_offset): Make static. Refactor to make the offset operand optional and assert we are dealing with addresses if its required. --- gcc/tree-loop-distribution.cc | 9 +++++---- gcc/tree-ssa-loop-ivopts.cc | 22 ++++++++++++++-------- gcc/tree-ssa-loop-ivopts.h | 1 - 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc index 6291f941a21..cf7c197aaf7 100644 --- a/gcc/tree-loop-distribution.cc +++ b/gcc/tree-loop-distribution.cc @@ -1756,11 +1756,12 @@ classify_builtin_st (loop_p loop, partition *partition, data_reference_p dr) return; } - poly_uint64 base_offset; - unsigned HOST_WIDE_INT const_base_offset; - tree base_base = strip_offset (base, &base_offset); - if (!base_offset.is_constant (&const_base_offset)) + tree base_offset; + tree base_base; + split_constant_offset (base, &base_base, &base_offset); + if (!cst_and_fits_in_hwi (base_offset)) return; + unsigned HOST_WIDE_INT const_base_offset = int_cst_value (base_offset); struct builtin_info *builtin; builtin = alloc_builtin (dr, NULL, base, NULL_TREE, size); diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc index 6fbd2d59318..7978c80b39e 100644 --- a/gcc/tree-ssa-loop-ivopts.cc +++ b/gcc/tree-ssa-loop-ivopts.cc @@ -1175,6 +1175,9 @@ contain_complex_addr_expr (tree expr) return res; } +static tree +strip_offset (tree expr, poly_uint64_pod *offset = nullptr); + /* Allocates an induction variable with given initial value BASE and step STEP for loop LOOP. NO_OVERFLOW implies the iv doesn't overflow. */ @@ -2942,12 +2945,16 @@ strip_offset_1 (tree expr, bool inside_addr, bool top_compref, /* Strips constant offsets from EXPR and stores them to OFFSET. */ -tree +static tree strip_offset (tree expr, poly_uint64_pod *offset) { poly_int64 off; tree core = strip_offset_1 (expr, false, false, &off); - *offset = off; + if (offset) + { + gcc_assert (POINTER_TYPE_P (expr)); + *offset = off; + } return core; } @@ -3512,7 +3519,6 @@ add_iv_candidate_derived_from_uses (struct ivopts_data *data) static void add_iv_candidate_for_use (struct ivopts_data *data, struct iv_use *use) { - poly_uint64 offset; tree base; struct iv *iv = use->iv; tree basetype = TREE_TYPE (iv->base); @@ -3563,8 +3569,8 @@ add_iv_candidate_for_use (struct ivopts_data *data, struct iv_use *use) /* Record common candidate with constant offset stripped in base. Like the use itself, we also add candidate directly for it. */ - base = strip_offset (iv->base, &offset); - if (maybe_ne (offset, 0U) || base != iv->base) + base = strip_offset (iv->base); + if (base != iv->base) { record_common_cand (data, base, iv->step, use); add_candidate (data, base, iv->step, false, use); @@ -3582,9 +3588,9 @@ add_iv_candidate_for_use (struct ivopts_data *data, struct iv_use *use) step = fold_convert (sizetype, step); record_common_cand (data, base, step, use); /* Also record common candidate with offset stripped. */ - base = strip_offset (base, &offset); - if (maybe_ne (offset, 0U)) - record_common_cand (data, base, step, use); + tree alt_base = strip_offset (base); + if (alt_base != base) + record_common_cand (data, alt_base, step, use); } /* At last, add auto-incremental candidates. Make such variables diff --git a/gcc/tree-ssa-loop-ivopts.h b/gcc/tree-ssa-loop-ivopts.h index 95148616e70..7a53ce47f10 100644 --- a/gcc/tree-ssa-loop-ivopts.h +++ b/gcc/tree-ssa-loop-ivopts.h @@ -28,7 +28,6 @@ extern void dump_cand (FILE *, struct iv_cand *); extern bool contains_abnormal_ssa_name_p (tree); extern class loop *outermost_invariant_loop_for_expr (class loop *, tree); extern bool expr_invariant_in_loop_p (class loop *, tree); -extern tree strip_offset (tree, poly_uint64_pod *); bool may_be_nonaddressable_p (tree expr); void tree_ssa_iv_optimize (void); From patchwork Wed Jun 21 11:31:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 110988 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4291431vqr; Wed, 21 Jun 2023 04:32:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6j4So+UvBtoUeYGBLWckzkTsCTNEugziMc0LnQXrnMHN5RUNcORpKLMFHPBFU/1/ICsKlJ X-Received: by 2002:a05:6402:7cd:b0:514:95b1:f0ba with SMTP id u13-20020a05640207cd00b0051495b1f0bamr10401653edy.34.1687347141202; Wed, 21 Jun 2023 04:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687347141; cv=none; d=google.com; s=arc-20160816; b=iXKsy5DrJityRBHuPlNGuJqI0nFfBpxgZtoCEYwfkCYCipzMbwgHRI+ynOcoU83m0K 6CiV/G3XWr/9JdDBhu0JwE6cJgIQr12BmlTHNtrt/BiSU1LQl2QaKIktk1W7W683b5dC vkNqyZOk1Vh6kiU1L1T6th8Y2ZQOBSEAl7nZlXEcAKRY8CxSoZu2Z/hQ7fNmM0N3cIys pmZMOm9VU+4h5fTi8KFIx+7s/RXMXoIAqZaqxy1q5wwaTeNFHx1ksaMa1SNU8y8Uktgo 0jWN4fO+ieP0RvDvcZ/0GnQ9+xtGmY1PJw0nkGB1+AOHNLt+62VualVG9bENpwnqUmz8 U8jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=+19LqpM/2WudgmbJ2fJdfDIO0f34YA1UEbagXADAcQU=; b=csY8PhTfrUoue5zPegsltH3IifxTseZQyAM+ZHxrqD5zdQNwDxBu/vZeMKltGCtmY5 ZtnS7757qez1xmWE7knTRLzLLoF2EfmQDIfMONhSF9K0P1cSalA6jrsFpYQsa1E339FY gGaWY8TgLgj7dqYPjp3auHhRySRM4APd0ElpGrfz3eYsXEdJaHN/4MJthfhAX+A3QySK s/k6B4TxRNHld/YLqIQTTT9BotOI+nSZcCS0OaHQMM8gPYg5nhyJZXafM8X/Sqi9vIHN 98E5iqSOSThrTzpXlE7eFlK+90dWYjyr7RLv/OGzqzikNTOcO4/WWHafc2FmI2KpItxr Htuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WBUipdyv; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d7-20020a50fb07000000b0051a2d737e80si754109edq.314.2023.06.21.04.32.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 04:32:21 -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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WBUipdyv; 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"; 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 B9E773857019 for ; Wed, 21 Jun 2023 11:31:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9E773857019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687347112; bh=+19LqpM/2WudgmbJ2fJdfDIO0f34YA1UEbagXADAcQU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WBUipdyv8rD6VYIdKChyTn26JaQTSgCXDJUPiP2wQpTe3/gdgEPb3+aa5W78/r7aH +NFYaqtorE1NmhPJwlC7K6rCv2p7WKQ47n5PtUUZ2RCOYw+gXCj0S/27oWZlLyEULA jDo0epLN0C3VcVTC2Mh/LiVWYuRUw/S19UEc+LtA= 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 [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id CA23D3858291 for ; Wed, 21 Jun 2023 11:31:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA23D3858291 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 0DA651FDDD for ; Wed, 21 Jun 2023 11:31:09 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 02AD12C141 for ; Wed, 21 Jun 2023 11:31:09 +0000 (UTC) Date: Wed, 21 Jun 2023 11:31:08 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/3] Less strip_offset in IVOPTs User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, 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: , 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" Message-Id: <20230621113152.B9E773857019@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769311716272558746?= X-GMAIL-MSGID: =?utf-8?q?1769311716272558746?= This avoids a strip_offset use in record_group_use where we know it operates on addresses. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-ssa-loop-ivopts.cc (record_group_use): Use split_constant_offset. --- gcc/tree-ssa-loop-ivopts.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc index 7978c80b39e..65caf382bba 100644 --- a/gcc/tree-ssa-loop-ivopts.cc +++ b/gcc/tree-ssa-loop-ivopts.cc @@ -1175,9 +1175,6 @@ contain_complex_addr_expr (tree expr) return res; } -static tree -strip_offset (tree expr, poly_uint64_pod *offset = nullptr); - /* Allocates an induction variable with given initial value BASE and step STEP for loop LOOP. NO_OVERFLOW implies the iv doesn't overflow. */ @@ -1609,7 +1606,10 @@ record_group_use (struct ivopts_data *data, tree *use_p, { unsigned int i; - addr_base = strip_offset (iv->base, &addr_offset); + gcc_assert (POINTER_TYPE_P (TREE_TYPE (iv->base))); + tree addr_toffset; + split_constant_offset (iv->base, &addr_base, &addr_toffset); + addr_offset = int_cst_value (addr_toffset); for (i = 0; i < data->vgroups.length (); i++) { struct iv_use *use; From patchwork Wed Jun 21 11:31:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 110989 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4291603vqr; Wed, 21 Jun 2023 04:32:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4odlw+forXtmlhoTMaIrsbKSl0ytcU0ne5XaV/aMmKH4z7nSPZf6QVInSh9ngPu6MLtbdi X-Received: by 2002:a17:907:980c:b0:988:c24d:3d33 with SMTP id ji12-20020a170907980c00b00988c24d3d33mr6355547ejc.12.1687347159830; Wed, 21 Jun 2023 04:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687347159; cv=none; d=google.com; s=arc-20160816; b=dOoOClm4wVvYU6AbMppyclGd4Vn94i7KHhlYl57yj41zydU81UsaTaeCY39hEe8P6g UOoiSrVBE5sRaBvvEfAPb98NEPANQFXFe+iEfqd0Gl4Bi811GCN/ofqqvsHTCh45GIsF d9BtHy5Cst94L6Pfx81n/f4s8nOZsIMWdsvgYYmxREilyr/Z67Fn220EhUU04jQP2KYS wKSsLq10STzTOiyJF4pKEutCVSKYi1C6F7Zh1QJ6OqbaQC7UF6vcW8id8X9c30Shq8Q5 McX/95I1R7D1BOUigEzWSV+Z2idu4OUGGAcLGKkCjZaLMRAZunJuwb47E/ocTFTWcf+x O26A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=eUQkMtbRPAu87rOEzoAtnp+b0lHADRw/teW18uh7YTg=; b=zoo1GjAkyxuAQNQ/W/ZV2p11uI/ZUlxcu0U+d/nxRAIemqzwmKChETSFUKuSnxIGL1 GyPMRwiHpqclK/fn0PGsRzZo5tia03jlGLeCsceq4oEUl/Kf+nB5PAyxGJOjw6yyoplG LJT17PvxsknRRwXMqSZuR0FZYyOCW+fqzB1j65bODa0oXKeOHzPaUpU2Nr+zOwwg1viq SkHRQjoXmccL46mwAEDIBy97YUQkYE2U87mKHBpN07PxouCC/Dr2ifLrcw5cs0AAkA/Z IjwGE3wyoeSHszPg+zxeGC8aQQePYfOQoAVMigW1VrRt/4gEa0IBEDytEnrsMoGEPTlN AaPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RddXkNzb; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q5-20020a1709060f8500b009890b54bf30si513243ejj.43.2023.06.21.04.32.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 04:32:39 -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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RddXkNzb; 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"; 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 3F9773856973 for ; Wed, 21 Jun 2023 11:32:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F9773856973 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687347126; bh=eUQkMtbRPAu87rOEzoAtnp+b0lHADRw/teW18uh7YTg=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=RddXkNzbrDENqgIqKAc+HbDsr6I5RVhPsL3emmVTo1DqBqyV0XUwVXknFwAlz/3U1 crXqFdcyIVRtgPqCd+fm7aYtztqxPWHcnehJbEqQhmvZcYJL9BnJ6+MtA0z3Z3HlYR jpkECkETmfFyC6EpBzzJZ3qT2X/1nIyNrcPQvLSw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id D3CCA3858033 for ; Wed, 21 Jun 2023 11:31:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D3CCA3858033 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 1275E21BE2 for ; Wed, 21 Jun 2023 11:31:22 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 05F8F2C141 for ; Wed, 21 Jun 2023 11:31:22 +0000 (UTC) Date: Wed, 21 Jun 2023 11:31:21 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/3] Less strip_offset in IVOPTs User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, 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: , 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" Message-Id: <20230621113206.3F9773856973@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769311716272558746?= X-GMAIL-MSGID: =?utf-8?q?1769311735274122528?= This avoids one strip_offset use in add_iv_candidate_for_use where we know it operates on a sizetype quantity. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-ssa-loop-ivopts.cc (add_iv_candidate_for_use): Use split_constant_offset for the POINTER_PLUS_EXPR case. --- gcc/tree-ssa-loop-ivopts.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc index 65caf382bba..03161813e0a 100644 --- a/gcc/tree-ssa-loop-ivopts.cc +++ b/gcc/tree-ssa-loop-ivopts.cc @@ -3588,8 +3588,9 @@ add_iv_candidate_for_use (struct ivopts_data *data, struct iv_use *use) step = fold_convert (sizetype, step); record_common_cand (data, base, step, use); /* Also record common candidate with offset stripped. */ - tree alt_base = strip_offset (base); - if (alt_base != base) + tree alt_base, alt_offset; + split_constant_offset (base, &alt_base, &alt_offset); + if (!integer_zerop (alt_offset)) record_common_cand (data, alt_base, step, use); }