summaryrefslogtreecommitdiff
path: root/gcc/jump.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-21 01:16:33 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-21 01:16:33 +0000
commit1e0703ac03f78786bec1d78ab305f8880b658ad6 (patch)
treef28f48b34144fa1f8eece6d07edcd6abcef71a4f /gcc/jump.c
parent8c7c29d9756dce88e59647f355e780ce0b6f8be4 (diff)
downloadgcc-1e0703ac03f78786bec1d78ab305f8880b658ad6.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67054 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/jump.c')
-rw-r--r--gcc/jump.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/jump.c b/gcc/jump.c
index f59fdbcf9a2..f15e2abae10 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -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;