Commit 30f5e9f5 by Richard Kenner

(final_scan_insn): Allow removal of redundant test and compare

instructions that use clobbers.

From-SVN: r11806
parent b089937a
...@@ -1756,26 +1756,29 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -1756,26 +1756,29 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
and the next statement should reexamine the variable and the next statement should reexamine the variable
to compute the condition codes. */ to compute the condition codes. */
if (optimize if (optimize)
&& GET_CODE (body) == SET {
&& GET_CODE (SET_DEST (body)) == CC0 rtx set = single_set(insn);
if (set
&& GET_CODE (SET_DEST (set)) == CC0
&& insn != last_ignored_compare) && insn != last_ignored_compare)
{ {
if (GET_CODE (SET_SRC (body)) == SUBREG) if (GET_CODE (SET_SRC (set)) == SUBREG)
SET_SRC (body) = alter_subreg (SET_SRC (body)); SET_SRC (set) = alter_subreg (SET_SRC (set));
else if (GET_CODE (SET_SRC (body)) == COMPARE) else if (GET_CODE (SET_SRC (set)) == COMPARE)
{ {
if (GET_CODE (XEXP (SET_SRC (body), 0)) == SUBREG) if (GET_CODE (XEXP (SET_SRC (set), 0)) == SUBREG)
XEXP (SET_SRC (body), 0) XEXP (SET_SRC (set), 0)
= alter_subreg (XEXP (SET_SRC (body), 0)); = alter_subreg (XEXP (SET_SRC (set), 0));
if (GET_CODE (XEXP (SET_SRC (body), 1)) == SUBREG) if (GET_CODE (XEXP (SET_SRC (set), 1)) == SUBREG)
XEXP (SET_SRC (body), 1) XEXP (SET_SRC (set), 1)
= alter_subreg (XEXP (SET_SRC (body), 1)); = alter_subreg (XEXP (SET_SRC (set), 1));
} }
if ((cc_status.value1 != 0 if ((cc_status.value1 != 0
&& rtx_equal_p (SET_SRC (body), cc_status.value1)) && rtx_equal_p (SET_SRC (set), cc_status.value1))
|| (cc_status.value2 != 0 || (cc_status.value2 != 0
&& rtx_equal_p (SET_SRC (body), cc_status.value2))) && rtx_equal_p (SET_SRC (set), cc_status.value2)))
{ {
/* Don't delete insn if it has an addressing side-effect. */ /* Don't delete insn if it has an addressing side-effect. */
if (! FIND_REG_INC_NOTE (insn, 0) if (! FIND_REG_INC_NOTE (insn, 0)
...@@ -1788,6 +1791,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -1788,6 +1791,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
} }
} }
} }
}
#endif #endif
/* Following a conditional branch, we have a new basic block. /* Following a conditional branch, we have a new basic block.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment