From patchwork Fri Jul 22 08:16:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 118 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f503:0:0:0:0:0 with SMTP id q3csp124077wro; Fri, 22 Jul 2022 01:17:08 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vMl25EqO1QqOFdY5hQKPTEN+PHmAbtVipe/zCQ9Q4UtNew2DFIhA2jizSSW+12ZNqsF0e2 X-Received: by 2002:a17:907:c06:b0:701:eb60:ded with SMTP id ga6-20020a1709070c0600b00701eb600dedmr2314786ejc.178.1658477827998; Fri, 22 Jul 2022 01:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658477827; cv=none; d=google.com; s=arc-20160816; b=NN1fYQljTZwPhTLRyTYIJhdNAfcRLY2BLGg2xoBZ7mFo4853VjhPIIWyhAWWR9DHnC 2tjug7o2sDEF5VAJpU+4mt91hFYHe1476WXpqIWseTivwY75B8vVHAcwMLFebmP4dK3s X/6+JUot4jc2yi3I5z0kN7llc1SL59MFRymqzW0QQQqp46Em2DvQh+7a3qswM0PXLs5C DPkMeA0dHbN2GnBYHPXLQWvSB2qmlivvZeRI92VHQjPT0zaQ/lo6ROuPzjL4JYNFFhYW oawfmuzixz++edK9VtCwEN9Fwo3rtP1jrynRmh7GsqTgOTxqFMkrnuguPuMm1ponBD/I 3mdw== 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=oeWSWtP7vpP88XOt18x7/wL0xHiB6u7KVqYcwOLseVU=; b=dDt18RsbjUKtpp9MjhLJ5EKTt9UN4ASlrRV5zD6s8YTHNTLMH8SM4ibug9WKLnW4Y+ xKyck18vZEd9UQ3gDVji17hOiyQFMu/Wkolzq0RiDpzkYR5zSmONEgC6Se8+MNH5OH3A 6zbG00iKTnwfAn+wjuXEm8WLe5qk1WlXB/xNnZaZaLjaeyTSCP8kKhRzMW8BIo+KwnZB eRnZYRd+0cOfORn4VnNnvaneAMusVpiJmLaJ8cHcq5RaoW7+ohaR05e0WFDxkl7rKIsv WPAio2CPSZzpq040d7urvLRUX6YzvhvUUahf7sF9YhEKxJ+glGn6fzvZ+/7o5ymCQBaS 6ihQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=MkEmEyX0; 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sb36-20020a1709076da400b006feed26a290si5674785ejc.42.2022.07.22.01.17.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 01:17:07 -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=MkEmEyX0; 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 E1675383540C for ; Fri, 22 Jul 2022 08:17:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E1675383540C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658477826; bh=oeWSWtP7vpP88XOt18x7/wL0xHiB6u7KVqYcwOLseVU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=MkEmEyX0SvIyVHq/d0o6xKsMAQOSfHLRpx0VXmTZ0i8mmjB2Lo1M6vnUJjAS9qoen 9Td/6U07Imy6yr6FDzF7NuOgsTtsc5iIDI6zvQ+biMALWSd7M0iDkHdX+4sbIpmmsU LjXZWUpt+1txjIAfu6F0UAcgWWwFUHE167XKXgKg= 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 4E84B3835839 for ; Fri, 22 Jul 2022 08:16:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E84B3835839 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 03ED933FEA for ; Fri, 22 Jul 2022 08:16:23 +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 F2B2E2C153 for ; Fri, 22 Jul 2022 08:16:22 +0000 (UTC) Date: Fri, 22 Jul 2022 08:16:22 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/106403 - fix ICE with VN of .STORE_LANES User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 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 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: "Li, Pan2 via Gcc-patches" Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20220722081706.E1675383540C@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1739040046709822966?= X-GMAIL-MSGID: =?utf-8?q?1739040046709822966?= While .STORE_LANES is not supported by the recent VN patch we were still accessing the stored value and valueizing it - but internal_fn_stored_value_index does not support .STORE_LANES and we failed to honor that case. Fixed by simply moving the affected code below the check for the actual supported internal functions. Bootstrap / regtest running on x86_64-unknown-linux-gnu. PR tree-optimization/106403 * tree-ssa-sccvn.cc (vn_reference_lookup_3): Move stored value valueization after check for IFN_MASKED_STORE or IFN_LEN_STORE. --- gcc/tree-ssa-sccvn.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 0ebbc69b502..741e6ebc4ba 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -3227,11 +3227,6 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, { gcall *call = as_a (def_stmt); internal_fn fn = gimple_call_internal_fn (call); - tree def_rhs = gimple_call_arg (call, - internal_fn_stored_value_index (fn)); - def_rhs = vn_valueize (def_rhs); - if (TREE_CODE (def_rhs) != VECTOR_CST) - return (void *)-1; tree mask = NULL_TREE, len = NULL_TREE, bias = NULL_TREE; switch (fn) @@ -3251,6 +3246,12 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, default: return (void *)-1; } + tree def_rhs = gimple_call_arg (call, + internal_fn_stored_value_index (fn)); + def_rhs = vn_valueize (def_rhs); + if (TREE_CODE (def_rhs) != VECTOR_CST) + return (void *)-1; + ao_ref_init_from_ptr_and_size (&lhs_ref, vn_valueize (gimple_call_arg (call, 0)), TYPE_SIZE_UNIT (TREE_TYPE (def_rhs)));