aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2011-12-19 15:29:21 -0500
committerSandra Loosemore <sandra@gcc.gnu.org>2011-12-19 15:29:21 -0500
commit8f1ad6b6bfd9102bf5e240191f3df95498188410 (patch)
tree2981ef68a72b8b5e256d21f7915180b8f476157f /gcc
parent1e815d32216f4c35208830b02c933895b1c2e9e2 (diff)
downloadgcc-8f1ad6b6bfd9102bf5e240191f3df95498188410.zip
gcc-8f1ad6b6bfd9102bf5e240191f3df95498188410.tar.gz
gcc-8f1ad6b6bfd9102bf5e240191f3df95498188410.tar.bz2
re PR rtl-optimization/50380 ([4.6 only] cc1 hangs eating 100% CPU)
2011-12-19 Sandra Loosemore <sandra@codesourcery.com> Tom de Vries <tom@codesourcery.com> PR rtl-opt/50380 gcc/ * cse.c (find_comparison_args): Detect fixed point and bail early. gcc/testsuite/ * gcc.c-torture/compile/pr50380.c: New testcase. Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r182498
Diffstat (limited to 'gcc')
-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;
+}