diff options
author | Roger Sayle <roger@eyesopen.com> | 2003-05-21 01:16:33 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2003-05-21 01:16:33 +0000 |
commit | bc6688b40ef6cc12e88a2498f82dbb2cd52ee443 (patch) | |
tree | f28f48b34144fa1f8eece6d07edcd6abcef71a4f /gcc/jump.c | |
parent | fc351800ecc6c2583d0e7be9d18eed6b0934563e (diff) | |
download | gcc-bc6688b40ef6cc12e88a2498f82dbb2cd52ee443.zip gcc-bc6688b40ef6cc12e88a2498f82dbb2cd52ee443.tar.gz gcc-bc6688b40ef6cc12e88a2498f82dbb2cd52ee443.tar.bz2 |
gcse.c (cprop_jump): Make use of REG_EQUAL notes on both setcc and jump, if they exist.
* gcse.c (cprop_jump): Make use of REG_EQUAL notes on both
setcc and jump, if they exist. If substituted instruction
fails to validate, store current effort in a REG_EQUAL note.
(cprop_insn): Don't attempt further substitutions if the
current instruction has been deleted.
(local_cprop_pass): Likewise.
* jump.c (redirect_jump): Also update REG_EQUAL note, if
one is attached to the jump instruction.
(invert_jump): Delete REG_EQUAL note on jump, if one exists.
Co-Authored-By: Joern Rennecke <joern.rennecke@superh.com>
Co-Authored-By: Kazu Hirata <kazu@cs.umass.edu>
From-SVN: r67054
Diffstat (limited to 'gcc/jump.c')
-rw-r--r-- | gcc/jump.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -2074,6 +2074,7 @@ redirect_jump (jump, nlabel, delete_unused) int delete_unused; { rtx olabel = JUMP_LABEL (jump); + rtx note; if (nlabel == olabel) return 1; @@ -2085,6 +2086,29 @@ redirect_jump (jump, nlabel, delete_unused) if (nlabel) ++LABEL_NUSES (nlabel); + /* Update labels in any REG_EQUAL note. */ + if ((note = find_reg_note (jump, REG_EQUAL, NULL_RTX)) != NULL_RTX) + { + if (nlabel && olabel) + { + rtx dest = XEXP (note, 0); + + if (GET_CODE (dest) == IF_THEN_ELSE) + { + if (GET_CODE (XEXP (dest, 1)) == LABEL_REF + && XEXP (XEXP (dest, 1), 0) == olabel) + XEXP (XEXP (dest, 1), 0) = nlabel; + if (GET_CODE (XEXP (dest, 2)) == LABEL_REF + && XEXP (XEXP (dest, 2), 0) == olabel) + XEXP (XEXP (dest, 2), 0) = nlabel; + } + else + remove_note (jump, note); + } + else + remove_note (jump, note); + } + /* If we're eliding the jump over exception cleanups at the end of a function, move the function end note so that -Wreturn-type works. */ if (olabel && nlabel @@ -2201,6 +2225,11 @@ invert_jump (jump, nlabel, delete_unused) if (redirect_jump (jump, nlabel, delete_unused)) { + /* Remove REG_EQUAL note if we have one. */ + rtx note = find_reg_note (jump, REG_EQUAL, NULL_RTX); + if (note) + remove_note (jump, note); + invert_br_probabilities (jump); return 1; |