From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) From: Richard Biener 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 Content-Type: text/plain; charset=US-ASCII 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-List-Received-Date: Fri, 22 Jul 2022 08:16:25 -0000 Message-ID: <20220722081622.JRON6BV0KeQqnBMvtheL3MzSzaoLCrJpi_F-6dINHBU@z> 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))); -- 2.35.3