diff options
author | Eric Botcazou <ebotcazou@libertysurf.fr> | 2003-10-06 10:52:23 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2003-10-06 08:52:23 +0000 |
commit | 8c03ca00a652f280811502a22cde311ef72cb861 (patch) | |
tree | 35ffc3762d6a06a4c760b2f310e77392b9d2a981 /gcc/combine.c | |
parent | 0cb733bf23082f82c44e9d8aac5264dfa516e9d3 (diff) | |
download | gcc-8c03ca00a652f280811502a22cde311ef72cb861.zip gcc-8c03ca00a652f280811502a22cde311ef72cb861.tar.gz gcc-8c03ca00a652f280811502a22cde311ef72cb861.tar.bz2 |
re PR rtl-optimization/11637 (g++ invalid assembly with -fnon-call-exceptions)
2003-10-06 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/11637
* combine.c (adjust_for_new_dest): New function to adjust the
notes and LOG_LINKS when the dest of an insn has changed.
(try_combine): Use it when deleting the first insn of a two-insn
parallel or splitting a two-load parallel.
From-SVN: r72138
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 5ad0a0f..7a0b5d3 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1438,6 +1438,33 @@ cant_combine_insn_p (rtx insn) return 0; } +/* Adjust INSN after we made a change to its destination. + + Changing the destination can invalidate notes that say something about + the results of the insn and a LOG_LINK pointing to the insn. */ + +static void +adjust_for_new_dest (rtx insn) +{ + rtx *loc; + + /* For notes, be conservative and simply remove them. */ + loc = ®_NOTES (insn); + while (*loc) + { + enum reg_note kind = REG_NOTE_KIND (*loc); + if (kind == REG_EQUAL || kind == REG_EQUIV) + *loc = XEXP (*loc, 1); + else + loc = &XEXP (*loc, 1); + } + + /* The new insn will have a destination that was previously the destination + of an insn just above it. Call distribute_links to make a LOG_LINK from + the next use of that destination. */ + distribute_links (gen_rtx_INSN_LIST (VOIDmode, insn, NULL_RTX)); +} + /* Try to combine the insns I1 and I2 into I3. Here I1 and I2 appear earlier than I3. I1 can be zero; then we combine just I2 into I3. @@ -2057,6 +2084,14 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) { newpat = XVECEXP (newpat, 0, 1); insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); + + if (insn_code_number >= 0) + { + /* If we will be able to accept this, we have made a change to the + destination of I3. This requires us to do a few adjustments. */ + PATTERN (i3) = newpat; + adjust_for_new_dest (i3); + } } /* If we were combining three insns and the result is a simple SET @@ -2327,16 +2362,9 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) rtx link; /* If we will be able to accept this, we have made a change to the - destination of I3. This can invalidate a LOG_LINKS pointing - to I3. No other part of combine.c makes such a transformation. - - The new I3 will have a destination that was previously the - destination of I1 or I2 and which was used in i2 or I3. Call - distribute_links to make a LOG_LINK from the next use of - that destination. */ - + destination of I3. This requires us to do a few adjustments. */ PATTERN (i3) = newpat; - distribute_links (gen_rtx_INSN_LIST (VOIDmode, i3, NULL_RTX)); + adjust_for_new_dest (i3); /* I3 now uses what used to be its destination and which is now I2's destination. That means we need a LOG_LINK from @@ -12909,8 +12937,8 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2) } /* Similarly to above, distribute the LOG_LINKS that used to be present on - I3, I2, and I1 to new locations. This is also called in one case to - add a link pointing at I3 when I3's destination is changed. */ + I3, I2, and I1 to new locations. This is also called to add a link + pointing at I3 when I3's destination is changed. */ static void distribute_links (rtx links) |