re PR debug/42662 (invalid rtl sharing found in the insn)

PR debug/42662
	* simplify-rtx.c (simplify_relational_operation_1): Avoid invalid rtx
	sharing when canonicalizing ({lt,ge}u (plus a b) b).

	* gcc.dg/pr42662.c: New test.

From-SVN: r155832
This commit is contained in:
Jakub Jelinek 2010-01-12 10:47:07 +01:00 committed by Jakub Jelinek
parent a0bd4a3a86
commit cebb4ea5a4
4 changed files with 62 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2010-01-12 Jakub Jelinek <jakub@redhat.com>
PR debug/42662
* simplify-rtx.c (simplify_relational_operation_1): Avoid invalid rtx
sharing when canonicalizing ({lt,ge}u (plus a b) b).
2010-01-09 Jakub Jelinek <jakub@redhat.com>
* gcc.c (process_command): Update copyright notice dates.

View File

@ -1,6 +1,6 @@
/* RTL simplification functions for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@ -3863,7 +3863,8 @@ simplify_relational_operation_1 (enum rtx_code code, enum machine_mode mode,
&& rtx_equal_p (op1, XEXP (op0, 1))
/* Don't recurse "infinitely" for (LTU/GEU (PLUS b b) b). */
&& !rtx_equal_p (op1, XEXP (op0, 0)))
return simplify_gen_relational (code, mode, cmp_mode, op0, XEXP (op0, 0));
return simplify_gen_relational (code, mode, cmp_mode, op0,
copy_rtx (XEXP (op0, 0)));
if (op1 == const0_rtx)
{

View File

@ -1,3 +1,8 @@
2010-01-12 Jakub Jelinek <jakub@redhat.com>
PR debug/42662
* gcc.dg/pr42662.c: New test.
2010-01-11 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/x86_64/abi/avx/asm-support.S (snapshot_ret): Preserve

View File

@ -0,0 +1,48 @@
/* PR debug/42662 */
/* { dg-do compile } */
/* { dg-options "-g -O2" } */
struct S { unsigned long s[17]; };
static inline void
foo (struct S *r, struct S *a, unsigned n)
{
unsigned b = n / 8;
r->s[0] = (b >= 1 ? : a->s[1 - b]);
}
static inline void
bar (struct S *r, struct S *a)
{
r->s[0] = a->s[0] << 1;
}
static inline void
baz (struct S *r, struct S *a, struct S *b)
{
unsigned c = 0;
int i;
for (i = 0; i < 3; ++i)
{
unsigned long d = a->s[i];
long e = d + b->s[i];
if (c)
++e == 0;
c = e < d;
r->s[i] = e;
}
}
void
test (struct S *r, int s, int d)
{
struct S u;
if (s)
{
bar (&u, r);
foo (r, r, 3);
baz (r, r, &u);
}
u.s[0] = d;
baz (r, r, &u);
}