re PR rtl-optimization/84878 (ICE: Segmentation fault (in add_cross_iteration_registe...
authorPeter Bergner <bergner@vnet.ibm.com>
Wed, 4 Apr 2018 15:35:03 +0000 (10:35 -0500)
committerPeter Bergner <bergner@gcc.gnu.org>
Wed, 4 Apr 2018 15:35:03 +0000 (10:35 -0500)
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
gcc/ddg.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr84878.c [new file with mode: 0644]

index f284fe8f350459f0c6ba2ccec36fbf947ee21f38..bce1b28705c643b6287b1ddcbbe006f2f9f073d4 100644 (file)
@@ -1,3 +1,10 @@
+2018-04-04  Peter Bergner  <bergner@vnet.ibm.com>
+
+       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  <matz@suse.de>
 
        * builtins.c (compute_objsize): Pass correct operand
index cffed2b3671b9b55561545c59613a67d148c5631..d51456618d6a92d0b8804d1511460dbed98dbf45 100644 (file)
--- 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);
index 0e7cd5a8a50f4ec89f2b18ab988bfe692c6c5b48..51f53290cd54d805cc9fc6561d5af68bdd89f6c9 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-04  Peter Bergner  <bergner@vnet.ibm.com>
+
+       PR rtl-optimization/84878
+       * gcc.target/powerpc/pr84878.c: New test.
+
 2018-04-04  Michael Matz  <matz@suse.de>
 
        * 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 (file)
index 0000000..f96d380
--- /dev/null
@@ -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;
+}