From: Jakub Jelinek Date: Fri, 4 Dec 2020 11:18:21 +0000 (+0100) Subject: debug: Fix another vector DECL_MODE ICE [PR98100] X-Git-Tag: releases/gcc-10.3.0~449 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c18faa4dd4dffdb76bc879b7555574ce3f4da01;p=thirdparty%2Fgcc.git debug: Fix another vector DECL_MODE ICE [PR98100] The PR88587 fix changes DECL_MODE of vars with vector type during inlining/cloning when the vars are copied, so that their DECL_MODE matches their TYPE_MODE in the new function. Unfortunately, the following testcase still ICEs, the var isn't really used in the new function and so it isn't copied, but becomes just a nonlocalized var. So we can't adjust its DECL_MODE because it appears in multiple functions and needs different modes in between them. The following patch changes the DEBUG_INSN creation to use TYPE_MODE instead of DECL_MODE for vars with vector types. 2020-12-04 Jakub Jelinek PR target/98100 * cfgexpand.c (expand_gimple_basic_block): For vars with vector type, use TYPE_MODE rather than DECL_MODE. * gcc.target/i386/pr98100.c: New test. (cherry picked from commit 704ccefb576dcf30b27a4b9bdacb6e15902f5307) --- diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 122a5ff7b65a..bf4f194ed993 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -5771,7 +5771,7 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) && !target_for_debug_bind (var)) goto delink_debug_stmt; - if (DECL_P (var)) + if (DECL_P (var) && !VECTOR_TYPE_P (TREE_TYPE (var))) mode = DECL_MODE (var); else mode = TYPE_MODE (TREE_TYPE (var)); @@ -5788,7 +5788,10 @@ expand_gimple_basic_block (basic_block bb, bool disable_tail_calls) value = gimple_debug_source_bind_get_value (stmt); - mode = DECL_MODE (var); + if (!VECTOR_TYPE_P (TREE_TYPE (var))) + mode = DECL_MODE (var); + else + mode = TYPE_MODE (TREE_TYPE (var)); val = gen_rtx_VAR_LOCATION (mode, var, (rtx)value, VAR_INIT_STATUS_UNINITIALIZED); diff --git a/gcc/testsuite/gcc.target/i386/pr98100.c b/gcc/testsuite/gcc.target/i386/pr98100.c new file mode 100644 index 000000000000..4deda1a498f3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr98100.c @@ -0,0 +1,9 @@ +/* PR target/98100 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-avx -fvar-tracking-assignments -g0" } */ + +__attribute__((target_clones("default","avx2"))) void +foo () +{ + __attribute__((__vector_size__(8 * sizeof(int)))) int b = {}; +}