From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 6D57A395C86F; Wed, 16 Sep 2020 19:22:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D57A395C86F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600284162; bh=CPEmoaoWB+gMIRkjasQ6DRGX4wodUbClH/SD/ffNwh8=; h=From:To:Subject:Date:From; b=mujcIx/4hD2y41/XUznuah7qowUI/VqcXldNyF0S4HZAZe9JmcxxyqZE9d0CEQfmj 6tM0cAlxHb8+K0knR90QgSu9AY/4E7yecKYMIw4hOsWgOXUWycwXnVR9Hybu+Zvvxe Bq5HO+1R1VBIU/wmG78qYTzlvRxzNCceo8jk9MPU= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r9-8905] veclower: Don't ICE on .VEC_CONVERT calls with no lhs [PR96426] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/releases/gcc-9 X-Git-Oldrev: fdcb6dae610aba75e23c1fd2d31b491691e54091 X-Git-Newrev: 3f804f63cde54ff94f35abd00953b050a4c861c7 Message-Id: <20200916192242.6D57A395C86F@sourceware.org> Date: Wed, 16 Sep 2020 19:22:42 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2020 19:22:42 -0000 https://gcc.gnu.org/g:3f804f63cde54ff94f35abd00953b050a4c861c7 commit r9-8905-g3f804f63cde54ff94f35abd00953b050a4c861c7 Author: Jakub Jelinek Date: Tue Aug 4 11:33:18 2020 +0200 veclower: Don't ICE on .VEC_CONVERT calls with no lhs [PR96426] .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. 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. (cherry picked from commit 95f5a3258dd8a9584f2b10304f79441ef2d4c64c) Diff: --- gcc/testsuite/gcc.c-torture/compile/pr96426.c | 10 ++++++++++ gcc/tree-vect-generic.c | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/gcc/testsuite/gcc.c-torture/compile/pr96426.c b/gcc/testsuite/gcc.c-torture/compile/pr96426.c new file mode 100644 index 00000000000..bd573fe5366 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr96426.c @@ -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); +} diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index 3e531facf67..1f255fa70c2 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -1691,6 +1691,12 @@ expand_vector_conversion (gimple_stmt_iterator *gsi) 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 decl = NULL_TREE; tree ret_type = TREE_TYPE (lhs);