Hi! 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.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2020-12-03 Jakub Jelinek <ja...@redhat.com> 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. --- gcc/cfgexpand.c.jj 2020-11-26 01:14:47.443082924 +0100 +++ gcc/cfgexpand.c 2020-12-03 14:25:07.772537435 +0100 @@ -5919,7 +5919,7 @@ expand_gimple_basic_block (basic_block b && !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)); @@ -5936,7 +5936,10 @@ expand_gimple_basic_block (basic_block b 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); --- gcc/testsuite/gcc.target/i386/pr98100.c.jj 2020-12-03 14:31:46.795106677 +0100 +++ gcc/testsuite/gcc.target/i386/pr98100.c 2020-12-03 14:31:16.862439052 +0100 @@ -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 = {}; +} Jakub