summaryrefslogtreecommitdiffstats
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2003-02-23 20:52:44 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2003-02-23 20:52:44 +0000
commit7cc73d08e2dfcf8c0626d94c67ce264713140255 (patch)
tree3ee791fedb3b0e683e67d2b7d4c0e238da919531 /gcc/gcse.c
parent080f90eb1f516f86c6b6b943f2acda4f4d4897e3 (diff)
downloadppe42-gcc-7cc73d08e2dfcf8c0626d94c67ce264713140255.tar.gz
ppe42-gcc-7cc73d08e2dfcf8c0626d94c67ce264713140255.zip
* gcse.c (cprop_jump): Use the REG_EQUAL note if available.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63332 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index f5bb66d0053..27dcc71ad13 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4058,19 +4058,33 @@ cprop_jump (bb, setcc, jump, from, src)
&& !modified_between_p (src, setcc, jump))
{
rtx setcc_set = single_set (setcc);
+ rtx note = find_reg_equal_equiv_note (setcc);
+ /* Use REG_EQUAL note if available. */
+ rtx setcc_set_src = (note == 0) ? SET_SRC (setcc_set) : XEXP (note, 0);
+
new_set = simplify_replace_rtx (SET_SRC (set),
SET_DEST (setcc_set),
- SET_SRC (setcc_set));
+ setcc_set_src);
}
else
new_set = set;
- new = simplify_replace_rtx (new_set, from, src);
+ /* If NEW_SET is simplified down to either a label or a no-op, we
+ don't have to replace FROM with SRC, but we still have to either
+ turn JUMP to an unconditional branch or remove the no-op. This
+ can happen if JUMP is simplified using the REG_EQUAL note in
+ SETCC. */
+ if (GET_CODE (new_set) == LABEL_REF || new_set == pc_rtx)
+ new = new_set;
+ else
+ {
+ new = simplify_replace_rtx (new_set, from, src);
- /* If no simplification can be made, then try the next
- register. */
- if (rtx_equal_p (new, new_set) || rtx_equal_p (new, SET_SRC (set)))
- return 0;
+ /* If no simplification can be made, then try the next
+ register. */
+ if (rtx_equal_p (new, new_set) || rtx_equal_p (new, SET_SRC (set)))
+ return 0;
+ }
/* If this is now a no-op delete it, otherwise this must be a valid insn. */
if (new == pc_rtx)
OpenPOWER on IntegriCloud