From patchwork Tue Aug 4 08:43:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1340734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: 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=g+8juYrD; 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLSwJ52Mlz9sRR for ; Tue, 4 Aug 2020 18:44:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7D7713842419; Tue, 4 Aug 2020 08:43:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D7713842419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596530637; bh=Cj3K+OSsIMiwQJK1rPZMWBMhqNJMM6kVxkWoBr0kaso=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=g+8juYrDIW1Yk/or4miIQPvo56OIsfnwJ5wDn0OB550BlxwL6HGpU3Zkuhbew6L26 Z8AZYr9DRFnvwHAZxn/QSBB6NC3kNaNs+v7lLbTJUgvDIL85AjouISVeaYIgYDgfJD neifjZh71RefjJ4hoGfOhekL07DIegfcLN4lFQyw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 9E42B3857C57 for ; Tue, 4 Aug 2020 08:43:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9E42B3857C57 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-358-iLGgGIZIOoyGmM4U8Jon4Q-1; Tue, 04 Aug 2020 04:43:53 -0400 X-MC-Unique: iLGgGIZIOoyGmM4U8Jon4Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8FA4B100CCC0; Tue, 4 Aug 2020 08:43:52 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-174.ams2.redhat.com [10.36.113.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C53060CD1; Tue, 4 Aug 2020 08:43:52 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 0748hnVb031241; Tue, 4 Aug 2020 10:43:49 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 0748hn9x031240; Tue, 4 Aug 2020 10:43:49 +0200 Date: Tue, 4 Aug 2020 10:43:48 +0200 To: Richard Biener Subject: [PATCH] veclower: Don't ICE on .VEC_CONVERT calls with no lhs [PR96426] Message-ID: <20200804084348.GZ2363@tucnak> MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi! .VEC_CONVERT is a const internal call, so normally if the lhs is not used, we'd DCE it far before getting to veclower, but with -O0 (or perhaps -fno-tree-dce and some other -fno-* options) it can happen. But as the internal fn needs the lhs to know the type to which the conversion is done (and I think that is a reasonable representation, having some magic another argument and having to create constants with that type looks overkill to me), we just should DCE those calls ourselves. During veclower, we can't really remove insns, as the callers would be upset, so this just replaces it with a GIMPLE_NOP. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2020-08-04 Jakub Jelinek PR middle-end/96426 * tree-vect-generic.c (expand_vector_conversion): Replace .VEC_CONVERT call with GIMPLE_NOP if there is no lhs. * gcc.c-torture/compile/pr96426.c: New test. Jakub --- gcc/tree-vect-generic.c.jj 2020-07-28 15:39:10.081755224 +0200 +++ gcc/tree-vect-generic.c 2020-08-03 12:34:32.193423693 +0200 @@ -1775,6 +1775,12 @@ expand_vector_conversion (gimple_stmt_it gimple *stmt = gsi_stmt (*gsi); gimple *g; tree lhs = gimple_call_lhs (stmt); + if (lhs == NULL_TREE) + { + g = gimple_build_nop (); + gsi_replace (gsi, g, false); + return; + } tree arg = gimple_call_arg (stmt, 0); tree ret_type = TREE_TYPE (lhs); tree arg_type = TREE_TYPE (arg); --- gcc/testsuite/gcc.c-torture/compile/pr96426.c.jj 2020-08-03 12:40:23.442449729 +0200 +++ gcc/testsuite/gcc.c-torture/compile/pr96426.c 2020-08-03 12:40:09.458647750 +0200 @@ -0,0 +1,10 @@ +/* PR middle-end/96426 */ + +typedef long long V __attribute__((vector_size(16))); +typedef double W __attribute__((vector_size(16))); + +void +foo (V *v) +{ + __builtin_convertvector (*v, W); +}