summaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-25 18:00:47 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-25 18:00:47 +0000
commitd7064052b49ccaf6a0e4b416598675f8e8adb682 (patch)
treec6ab0e183d73e53aef30128acd6690f703e71220 /gcc/combine.c
parent0aebbaada85d9596614626382bbb5e0d725c0fe2 (diff)
downloadgcc-d7064052b49ccaf6a0e4b416598675f8e8adb682.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167148 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index c557e8c65c8..a8ce701efb0 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3096,10 +3096,12 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p)
/* If I1 feeds into I2 and I1DEST is in I1SRC, we need to make a unique
copy of I2SRC each time we substitute it, in order to avoid creating
self-referential RTL when we will be substituting I1SRC for I1DEST
- later. Likewise if I0 feeds into I2 and I0DEST is in I0SRC. */
+ later. Likewise if I0 feeds into I2, either directly or indirectly
+ through I1, 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. */