summaryrefslogtreecommitdiff
path: root/gcc/flow.c
diff options
context:
space:
mode:
authorJohn Wehle <john@feith.com>2001-10-11 03:51:24 +0000
committerJohn Wehle <wehle@gcc.gnu.org>2001-10-11 03:51:24 +0000
commiteb9d8e4d0ba0b89881d024c23ca5866bbc359409 (patch)
tree57d914a811598a624f337dd3ee4f78fbb3d988ff /gcc/flow.c
parentb36948478c22c58018d0a888ee8ca393dea60dc9 (diff)
downloadgcc-eb9d8e4d0ba0b89881d024c23ca5866bbc359409.tar.gz
rtlanal.c (noop_move_p): Insns with a REG_RETVAL note should not be considered as a no-op.
* rtlanal.c (noop_move_p): Insns with a REG_RETVAL note should not be considered as a no-op. * flow.c (delete_noop_moves): Handle REG_LIBCALL notes. From-SVN: r46174
Diffstat (limited to 'gcc/flow.c')
-rw-r--r--gcc/flow.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/flow.c b/gcc/flow.c
index f0dd62e3149..030a2337052 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -771,8 +771,25 @@ delete_noop_moves (f)
next = NEXT_INSN (insn);
if (INSN_P (insn) && noop_move_p (insn))
{
- /* Do not call delete_insn here to not confuse backward
- pointers of LIBCALL block. */
+ rtx note;
+
+ /* If we're about to remove the first insn of a libcall
+ then move the libcall note to the next real insn and
+ update the retval note. */
+ if ((note = find_reg_note (insn, REG_LIBCALL, NULL_RTX))
+ && XEXP (note, 0) != insn)
+ {
+ rtx new_libcall_insn = next_real_insn (insn);
+ rtx retval_note = find_reg_note (XEXP (note, 0),
+ REG_RETVAL, NULL_RTX);
+ REG_NOTES (new_libcall_insn)
+ = gen_rtx_INSN_LIST (REG_LIBCALL, XEXP (note, 0),
+ REG_NOTES (new_libcall_insn));
+ XEXP (retval_note, 0) = new_libcall_insn;
+ }
+
+ /* Do not call delete_insn here since that may change
+ the basic block boundaries which upsets some callers. */
PUT_CODE (insn, NOTE);
NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
NOTE_SOURCE_FILE (insn) = 0;