]> gcc.gnu.org Git - gcc.git/commitdiff
re PR rtl-optimization/47157 (ICE: in calc_dfs_tree, at dominance.c:395 with -O)
authorJakub Jelinek <jakub@redhat.com>
Mon, 3 Jan 2011 20:59:20 +0000 (21:59 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 3 Jan 2011 20:59:20 +0000 (21:59 +0100)
PR rtl-optimization/47157
* combine.c (try_combine): If undobuf.other_insn becomes
(set (pc) (pc)) jump, call update_cfg_for_uncondjump on it
and set *new_direct_jump_p too.

* gcc.c-torture/compile/pr47157.c: New test.

From-SVN: r168439

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr47157.c [new file with mode: 0644]

index 3ec20c476c12c9db08ca104859e41fd03082de9e..62bd11e655a3cb88e59e8e9e76b8639de10bd2b9 100644 (file)
@@ -1,3 +1,10 @@
+2011-01-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/47157
+       * combine.c (try_combine): If undobuf.other_insn becomes
+       (set (pc) (pc)) jump, call update_cfg_for_uncondjump on it
+       and set *new_direct_jump_p too.
+
 2011-01-03  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR tree-optimization/47021
index d9d68384a2a65e4912149a55ca5bbb8c682d33e6..3ee53e6ccd9637b915cd5a7511b75f1ff91b3e0c 100644 (file)
@@ -1,7 +1,7 @@
 /* Optimize by combining instructions for GNU compiler.
    Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+   2011 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -4378,6 +4378,15 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p)
       update_cfg_for_uncondjump (i3);
     }
 
+  if (undobuf.other_insn != NULL_RTX
+      && GET_CODE (PATTERN (undobuf.other_insn)) == SET
+      && SET_SRC (PATTERN (undobuf.other_insn)) == pc_rtx
+      && SET_DEST (PATTERN (undobuf.other_insn)) == pc_rtx)
+    {
+      *new_direct_jump_p = 1;
+      update_cfg_for_uncondjump (undobuf.other_insn);
+    }
+
   combine_successes++;
   undo_commit ();
 
index 11e75bc159b0e3fae821d3567031fa4fb3a195f3..910fa08c98c9ae76b9f5201fe6238a05387f7db2 100644 (file)
@@ -1,3 +1,8 @@
+2011-01-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/47157
+       * gcc.c-torture/compile/pr47157.c: New test.
+
 2011-01-03  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
        * gcc.dg/torture/vector-shift2.c (schar): Define.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47157.c b/gcc/testsuite/gcc.c-torture/compile/pr47157.c
new file mode 100644 (file)
index 0000000..0947a5f
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR rtl-optimization/47157 */
+
+struct S { unsigned a; unsigned b; } c = { 1, 0 };
+unsigned long int e;
+void bar (int);
+int baz (void);
+
+static int
+foo (int x, short y)
+{
+  return ((x ^ y) & ((x ^ (x ^ y) & ~__INT_MAX__) - y ^ y)) < 0 ? x : x - y;
+}
+
+void
+test (void)
+{
+  bar (foo (baz () != (c.a | c.b), -1L));
+  for (e = 0; e; e = 1)
+    ;
+}
This page took 0.076592 seconds and 5 git commands to generate.