Message ID | 20101124214105.GF29412@tyan-ft48-01.lab.bos.redhat.com |
---|---|
State | New |
Headers | show |
> 2010-11-24 Jakub Jelinek <jakub@redhat.com> > > PR middle-end/46637 > * combine.c (try_combine): When substing i2dest for i2src, pass > 1 as last argument even if > i0_feeds_i1_n && i1_feeds_i2_n && i0dest_in_i0src. > > * gcc.c-torture/compile/pr46637.c: New test. OK, but the comment also needs to be adjusted, for example: later. Likewise if I0 feeds into I2, either directly or indirectly through I1, and I0DEST is in I0SRC. */
--- gcc/combine.c.jj 2010-11-19 20:56:55.000000000 +0100 +++ gcc/combine.c 2010-11-24 14:29:39.000000000 +0100 @@ -3099,7 +3099,8 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx later. Likewise if I0 feeds into I2 and I0DEST is in I0SRC. */ newpat = subst (PATTERN (i3), i2dest, i2src, 0, (i1_feeds_i2_n && i1dest_in_i1src) - || (i0_feeds_i2_n && i0dest_in_i0src)); + || ((i0_feeds_i2_n || (i0_feeds_i1_n && i1_feeds_i2_n)) + && i0dest_in_i0src)); substed_i2 = 1; /* Record whether I2's body now appears within I3's body. */ --- gcc/testsuite/gcc.c-torture/compile/pr46637.c.jj 2010-11-24 14:38:02.000000000 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr46637.c 2010-11-24 14:37:52.000000000 +0100 @@ -0,0 +1,11 @@ +/* PR middle-end/46637 */ + +struct S { int s[5]; } *p; + +void +foo (long x) +{ + long a = x == 1 ? 4L : 1L; + asm ("" : "+m" (p->s[a])); + p->s[0]++; +}