From: Jakub Jelinek Date: Fri, 2 Dec 2016 08:42:12 +0000 (+0100) Subject: re PR rtl-optimization/78575 (ICE: in trunc_int_for_mode, at explow.c:55 with -O2 -g) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a717444986a981b21b42fccfd982dcb6ebe42254;p=gcc.git re PR rtl-optimization/78575 (ICE: in trunc_int_for_mode, at explow.c:55 with -O2 -g) PR rtl-optimization/78575 * config/i386/i386.c (timode_scalar_chain::fix_debug_reg_uses): Use DF infrastructure to wrap all V1TImode reg uses into TImode subreg if not already wrapped in a subreg. Make sure df_insn_rescan does not affect further iterations. * gcc.dg/pr78575.c: New test. From-SVN: r243164 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 445384226cc..a83f5280b92 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-12-02 Jakub Jelinek + + PR rtl-optimization/78575 + * config/i386/i386.c (timode_scalar_chain::fix_debug_reg_uses): Use + DF infrastructure to wrap all V1TImode reg uses into TImode subreg + if not already wrapped in a subreg. Make sure df_insn_rescan does not + affect further iterations. + 2016-12-02 Martin Liska PR ipa/78555 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a5f5339be67..5226e45440a 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -3831,30 +3831,32 @@ timode_scalar_chain::fix_debug_reg_uses (rtx reg) if (!flag_var_tracking) return; - df_ref ref; - for (ref = DF_REG_USE_CHAIN (REGNO (reg)); - ref; - ref = DF_REF_NEXT_REG (ref)) + df_ref ref, next; + for (ref = DF_REG_USE_CHAIN (REGNO (reg)); ref; ref = next) { rtx_insn *insn = DF_REF_INSN (ref); + /* Make sure the next ref is for a different instruction, + so that we're not affected by the rescan. */ + next = DF_REF_NEXT_REG (ref); + while (next && DF_REF_INSN (next) == insn) + next = DF_REF_NEXT_REG (next); + if (DEBUG_INSN_P (insn)) { /* It may be a debug insn with a TImode variable in register. */ - rtx val = PATTERN (insn); - if (GET_MODE (val) != TImode) - continue; - gcc_assert (GET_CODE (val) == VAR_LOCATION); - rtx loc = PAT_VAR_LOCATION_LOC (val); - /* It may have been converted to TImode already. */ - if (GET_MODE (loc) == TImode) - continue; - gcc_assert (REG_P (loc) - && GET_MODE (loc) == V1TImode); - /* Convert V1TImode register, which has been updated by a SET - insn before, to SUBREG TImode. */ - PAT_VAR_LOCATION_LOC (val) = gen_rtx_SUBREG (TImode, loc, 0); - df_insn_rescan (insn); + bool changed = false; + for (; ref != next; ref = DF_REF_NEXT_REG (ref)) + { + rtx *loc = DF_REF_LOC (ref); + if (REG_P (*loc) && GET_MODE (*loc) == V1TImode) + { + *loc = gen_rtx_SUBREG (TImode, *loc, 0); + changed = true; + } + } + if (changed) + df_insn_rescan (insn); } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 14296a31b09..6ee4b1354ec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-02 Jakub Jelinek + + PR rtl-optimization/78575 + * gcc.dg/pr78575.c: New test. + 2016-12-02 Dominik Vogt * gcc.target/s390/litpool-r3-1.c: Fix label number test. diff --git a/gcc/testsuite/gcc.dg/pr78575.c b/gcc/testsuite/gcc.dg/pr78575.c new file mode 100644 index 00000000000..6b27f10706a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr78575.c @@ -0,0 +1,16 @@ +/* PR rtl-optimization/78575 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -g -Wno-psabi" } */ + +typedef unsigned __int128 V __attribute__((vector_size(64))); + +V g; + +void +foo (V v) +{ + unsigned __int128 x = 1; + int c = v[1] <= ~x; + v &= v[1]; + g = v; +}