aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cse.c6
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr50380.c12
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c2680c6..02c8dce 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2011-12-19 Sandra Loosemore <sandra@codesourcery.com>
+ Tom de Vries <tom@codesourcery.com>
+
+ PR rtl-opt/50380
+ * cse.c (find_comparison_args): Detect fixed point and
+ bail early.
+
2011-12-19 Aldy Hernandez <aldyh@redhat.com>
PR middle-end/51411
diff --git a/gcc/cse.c b/gcc/cse.c
index ae67685..e624b28 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3055,6 +3055,12 @@ find_comparison_args (enum rtx_code code, rtx *parg1, rtx *parg2,
if (! exp_equiv_p (p->exp, p->exp, 1, false))
continue;
+ /* If it's the same comparison we're already looking at, skip it. */
+ if (COMPARISON_P (p->exp)
+ && XEXP (p->exp, 0) == arg1
+ && XEXP (p->exp, 1) == arg2)
+ continue;
+
if (GET_CODE (p->exp) == COMPARE
/* Another possibility is that this machine has a compare insn
that includes the comparison code. In that case, ARG1 would
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 701fce8..cf758f1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2011-12-19 Sandra Loosemore <sandra@codesourcery.com>
+ Tom de Vries <tom@codesourcery.com>
+
+ PR rtl-opt/50380
+ * gcc.c-torture/compile/pr50380.c: New testcase.
+
2011-12-19 Tobias Burnus <burnus@net-b.de>
PR fortran/51605
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr50380.c b/gcc/testsuite/gcc.c-torture/compile/pr50380.c
new file mode 100644
index 0000000..ffd0442
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr50380.c
@@ -0,0 +1,12 @@
+/* This test used to get stuck in an infinite loop in find_comparison_args
+ when compiling for MIPS at -O2. */
+
+__attribute__ ((__noreturn__)) extern void fail (void);
+
+char x;
+
+void foo (const unsigned char y)
+{
+ ((void) (__builtin_expect((!! y == y), 1) ? 0 : (fail (), 0)));
+ x = ! y;
+}