| Submitter | Jakub Jelinek |
|---|---|
| Date | Oct. 22, 2012, 7:23 p.m. |
| Message ID | <20121022192331.GE1752@tucnak.redhat.com> |
| Download | mbox | patch |
| Permalink | /patch/193260/ |
| State | New |
| Headers | show |
Comments
> On the following testcase we have IF_THEN_ELSE in insn notes, > and when folding it, folded_arg1 is a subreg from earlier CC setter, > as the other argument has equiv constant, simplify_relational_operation > is called on it to simplify it and we end up with invalid RTL sharing > of the subreg in between the CC setter insn and the insn with the REG_EQ* > note. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk? > > 2012-10-22 Jakub Jelinek <jakub@redhat.com> > > PR rtl-optimization/55010 > * cse.c (fold_rtx): Call copy_rtx on folded_arg{0,1} before passing > it to simplify_relational_operation. OK with: * cse.c (fold_rtx) <RTX_COMPARE>: Call copy_rtx on ... and if you also fix the long simplify_relational_operation line.
Patch
--- gcc/cse.c.jj 2012-10-16 13:15:45.000000000 +0200 +++ gcc/cse.c 2012-10-22 10:44:34.100033945 +0200 @@ -3461,8 +3461,8 @@ fold_rtx (rtx x, rtx insn) } { - rtx op0 = const_arg0 ? const_arg0 : folded_arg0; - rtx op1 = const_arg1 ? const_arg1 : folded_arg1; + rtx op0 = const_arg0 ? const_arg0 : copy_rtx (folded_arg0); + rtx op1 = const_arg1 ? const_arg1 : copy_rtx (folded_arg1); new_rtx = simplify_relational_operation (code, mode, mode_arg0, op0, op1); } break; --- gcc/testsuite/gcc.dg/pr55010.c.jj 2012-10-22 10:47:47.289857369 +0200 +++ gcc/testsuite/gcc.dg/pr55010.c 2012-10-22 10:47:33.000000000 +0200 @@ -0,0 +1,13 @@ +/* PR rtl-optimization/55010 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-march=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ + +long long int a; +unsigned long long int b; + +void +foo (void) +{ + a = (a < 0) / ((a -= b) ? b >= ((b = a) || 0) : 0); +}
Hi! On the following testcase we have IF_THEN_ELSE in insn notes, and when folding it, folded_arg1 is a subreg from earlier CC setter, as the other argument has equiv constant, simplify_relational_operation is called on it to simplify it and we end up with invalid RTL sharing of the subreg in between the CC setter insn and the insn with the REG_EQ* note. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-10-22 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/55010 * cse.c (fold_rtx): Call copy_rtx on folded_arg{0,1} before passing it to simplify_relational_operation. * gcc.dg/pr55010.c: New test. Jakub