From 8c760464d0148aba6bc8a2f2ab7ecf6a8fd43127 Mon Sep 17 00:00:00 2001 From: Peter Bergner Date: Wed, 4 Apr 2018 10:35:03 -0500 Subject: [PATCH] re PR rtl-optimization/84878 (ICE: Segmentation fault (in add_cross_iteration_register_deps)) gcc/ PR rtl-optimization/84878 * ddg.c (add_cross_iteration_register_deps): Use DF_REF_BB to determine the basic block. Assert the use reference is not artificial and that it has an associated insn. gcc/testsuite/ PR rtl-optimization/84878 * gcc.target/powerpc/pr84878.c: New test. From-SVN: r259085 --- gcc/ChangeLog | 7 +++++++ gcc/ddg.c | 9 ++++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/powerpc/pr84878.c | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr84878.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f284fe8f350..bce1b28705c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-04-04 Peter Bergner + + PR rtl-optimization/84878 + * ddg.c (add_cross_iteration_register_deps): Use DF_REF_BB to determine + the basic block. Assert the use reference is not artificial and that + it has an associated insn. + 2018-04-04 Michael Matz * builtins.c (compute_objsize): Pass correct operand diff --git a/gcc/ddg.c b/gcc/ddg.c index cffed2b3671..d51456618d6 100644 --- a/gcc/ddg.c +++ b/gcc/ddg.c @@ -295,11 +295,14 @@ add_cross_iteration_register_deps (ddg_ptr g, df_ref last_def) /* Create inter-loop true dependences and anti dependences. */ for (r_use = DF_REF_CHAIN (last_def); r_use != NULL; r_use = r_use->next) { - rtx_insn *use_insn = DF_REF_INSN (r_use->ref); - - if (BLOCK_FOR_INSN (use_insn) != g->bb) + if (DF_REF_BB (r_use->ref) != g->bb) continue; + gcc_assert (!DF_REF_IS_ARTIFICIAL (r_use->ref) + && DF_REF_INSN_INFO (r_use->ref) != NULL); + + rtx_insn *use_insn = DF_REF_INSN (r_use->ref); + /* ??? Do not handle uses with DF_REF_IN_NOTE notes. */ use_node = get_node_of_insn (g, use_insn); gcc_assert (use_node); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0e7cd5a8a50..51f53290cd5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-04 Peter Bergner + + PR rtl-optimization/84878 + * gcc.target/powerpc/pr84878.c: New test. + 2018-04-04 Michael Matz * gcc.dg/Wstringop-overflow-4.c: New test. diff --git a/gcc/testsuite/gcc.target/powerpc/pr84878.c b/gcc/testsuite/gcc.target/powerpc/pr84878.c new file mode 100644 index 00000000000..f96d3803d06 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr84878.c @@ -0,0 +1,18 @@ +/* PR rtl-optimization/84878 */ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-O2 -maltivec -mno-vsx -fmodulo-sched -ftree-vectorize -funroll-loops -fassociative-math -fno-signed-zeros -fno-trapping-math" } */ + +int ek; +float zu; + +int +k5 (int ks) +{ + while (ek < 1) + { + ks += (int)(0x1000000 + zu + !ek); + ++ek; + } + return ks; +} -- 2.30.2