diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-03 08:30:21 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-03 08:30:21 +0000 |
commit | 446c6cb5425185b03464f8e077381a786fb3a4ff (patch) | |
tree | 9662fee926c1689b6a8d33a0e625c0547515c5dc /gcc/combine.c | |
parent | 075f1161cb9f82bd079949405df6c8e54bce6d94 (diff) | |
download | gcc-446c6cb5425185b03464f8e077381a786fb3a4ff.tar.gz |
PR rtl-optimization/46034
PR rtl-optimization/46212
PR rtl-optimization/46248
* combine.c (try_combine): If added_sets_2 where i0dest_in_i0src
and i0 feeds i1 and i1 feeds i2 or i0 feeds i2, make a copy of i1src
before i0dest -> i0src substitution and pass 1 instead of 0 as last
argument to subst on i2pat.
* gcc.c-torture/compile/pr46034.c: New test.
* gcc.c-torture/compile/pr46248.c: New test.
* gcc.dg/pr46212.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166231 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 88b3ca5e15f..3bf65698185 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2502,6 +2502,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p) rtx i3dest_killed = 0; /* SET_DEST and SET_SRC of I2, I1 and I0. */ rtx i2dest = 0, i2src = 0, i1dest = 0, i1src = 0, i0dest = 0, i0src = 0; + rtx i1src_copy = 0; /* Set if I2DEST was reused as a scratch register. */ bool i2scratch = false; /* The PATTERNs of I0, I1, and I2, or a copy of them in certain cases. */ @@ -3128,6 +3129,11 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p) return 0; } + /* Following subst may modify i1src, make a copy of it + before it is for added_sets_2 handling if needed. */ + if (i0_feeds_i1_n && added_sets_2 && i1_feeds_i2_n) + i1src_copy = copy_rtx (i1src); + n_occurrences = 0; subst_low_luid = DF_INSN_LUID (i0); newpat = subst (newpat, i0dest, i0src, 0, @@ -3200,11 +3206,10 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p) if (added_sets_2) { rtx t = i2pat; - if (i0_feeds_i2_n) - t = subst (t, i0dest, i0src, 0, 0); if (i1_feeds_i2_n) - t = subst (t, i1dest, i1src, 0, 0); - if (i0_feeds_i1_n && i1_feeds_i2_n) + t = subst (t, i1dest, i1src_copy ? i1src_copy : i1src, 0, + i0_feeds_i1_n && i0dest_in_i0src); + if ((i0_feeds_i1_n && i1_feeds_i2_n) || i0_feeds_i2_n) t = subst (t, i0dest, i0src, 0, 0); XVECEXP (newpat, 0, --total_sets) = t; |