From patchwork Sat Apr 8 18:27:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1766957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=j00ImsPb; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Pv3dL3bXDz1yZC for ; Sun, 9 Apr 2023 04:28:04 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8A7F43858C27 for ; Sat, 8 Apr 2023 18:28:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A7F43858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680978482; bh=Nmk6Tg4HIZU1b+AoPewt7oUvn/l8Pk4VqNEBh0//36o=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=j00ImsPbaXhE2LpKsFLPZ/xD7nX0Pf/ztzrjdPW0qteiAymyEjR128Lg3bhMeZcXe 5FMA8tvssOTYqIr8gIE/rnRv0/IMsw3oQko6pm1VBk06Fn7ZCo/dH/GW7ubK4TfCXR X/gYtEBudCKIhI3/g4Q1oYQ7ZBAOeth92v2VyZ/Y= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id C9E2D3858D1E for ; Sat, 8 Apr 2023 18:27:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C9E2D3858D1E Received: by mail-pl1-x62c.google.com with SMTP id q2so6349701pll.7 for ; Sat, 08 Apr 2023 11:27:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680978460; x=1683570460; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Nmk6Tg4HIZU1b+AoPewt7oUvn/l8Pk4VqNEBh0//36o=; b=dlHjqJVDoFj+R2L+NRy/jnxWqCP6DcA/eD2LPjhQT3xpoNtgwyhOd3W90dWLybdzOi KkBDc7DCnMkz2rIMGRBdOd24E8ttOLB0dPtXyXCtyFnWg20vCRwbmbVr/8nYufbaHvUO RiTglC88XPrbRk7vuDrtSMU9SFimw+G1+RFXK9O38RNPdCVfGaqMZT97ga7O0/Cimgzp njN8OzEfa5DPllIiBumXk813McSooI2E5EbcqDThEvX56dH5McE8dP3vgaaLRraiXinG Xiiv6WUOiD/n6otAIkOaRvO7rhPXzRHmo4/z3xG71TsQBNbL3x7hOZNMh1Cs/jp2zM7G s9xw== X-Gm-Message-State: AAQBX9e1m9nmQqFBsRv2jJFvq42Q1NwIPZOQueuAJCWND2cLlwcuwNUF bMk0ne4Rh1f9b5Jq4fwcdlSkkMWhs8g= X-Google-Smtp-Source: AKy350bf9jqZeCLs99ONFkei8D0frYMrLbrMc+fIqamnhQASfX55z4WIGchY7K7/ReHkZT/8Jt1DIA== X-Received: by 2002:a17:903:1111:b0:1a4:f295:32fa with SMTP id n17-20020a170903111100b001a4f29532famr7389160plh.15.1680978460183; Sat, 08 Apr 2023 11:27:40 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::f0a? ([2601:681:8600:13d0::f0a]) by smtp.gmail.com with ESMTPSA id f16-20020a170902ab9000b001a1d4a985eesm4793082plr.228.2023.04.08.11.27.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Apr 2023 11:27:39 -0700 (PDT) Message-ID: <15b03560-d4cf-d045-6a27-f0a6e2651fbe@gmail.com> Date: Sat, 8 Apr 2023 12:27:38 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Cc: Jakub Jelinek Subject: [committed] [PR tree-optimization/109392] Handle failure from maybe_push_res_to_seq X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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: Jeff Law via Gcc-patches From: Jeff Law Reply-To: Jeff Law Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" I was scanning through the P3s today and saw this patch from Jakub to fix 109392. It looked quite reasonable, so I went ahead and did the bootstrap & regression test. Everything looked good and I've applied it to the trunk. Jeff commit 101380a8394c22a7a2ea70de2060ee93716156e2 Author: Jakub Jelinek Date: Sat Apr 8 12:21:42 2023 -0600 PR tree-optimization/109392 If we have an object with SSA_NAME_OCCURS_IN_ABNORMAL_PHI, then maybe_push_res_to_seq may fail. Directly build the extraction for that case. PR tree-optimization/109392 gcc/ * tree-vect-generic.cc (tree_vec_extract): Handle failure of maybe_push_res_to_seq better. gcc/testsuite/ * gcc.dg/pr109392.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr109392.c b/gcc/testsuite/gcc.dg/pr109392.c new file mode 100644 index 00000000000..e5bd9d440fa --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr109392.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/109392 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wno-psabi" } */ + +typedef short __attribute__ ((__vector_size__ (64))) V; +V v, w; +void bar (void) __attribute__((returns_twice)); + +V +foo (V a, V b) +{ + bar (); + b &= v < b; + return (V) { foo (b, w)[3], (V) {}[3] }; +} diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index 67f138a9332..445da53292e 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -174,7 +174,16 @@ tree_vec_extract (gimple_stmt_iterator *gsi, tree type, opr.resimplify (NULL, follow_all_ssa_edges); gimple_seq stmts = NULL; tree res = maybe_push_res_to_seq (&opr, &stmts); - gcc_assert (res); + if (!res) + { + /* This can happen if SSA_NAME_OCCURS_IN_ABNORMAL_PHI are + used. Build BIT_FIELD_REF manually otherwise. */ + t = build3 (BIT_FIELD_REF, type, t, bitsize, bitpos); + res = make_ssa_name (type); + gimple *g = gimple_build_assign (res, t); + gsi_insert_before (gsi, g, GSI_SAME_STMT); + return res; + } gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); return res; }