From 30f5e9f517eee66f7b18b804bfedd3e120457e7c Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Tue, 16 Apr 1996 08:53:07 -0400 Subject: (final_scan_insn): Allow removal of redundant test and compare instructions that use clobbers. From-SVN: r11806 --- gcc/final.c | 56 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'gcc/final.c') diff --git a/gcc/final.c b/gcc/final.c index 882850f..70aa819 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1756,35 +1756,39 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) and the next statement should reexamine the variable to compute the condition codes. */ - if (optimize - && GET_CODE (body) == SET - && GET_CODE (SET_DEST (body)) == CC0 - && insn != last_ignored_compare) + if (optimize) { - if (GET_CODE (SET_SRC (body)) == SUBREG) - SET_SRC (body) = alter_subreg (SET_SRC (body)); - else if (GET_CODE (SET_SRC (body)) == COMPARE) - { - if (GET_CODE (XEXP (SET_SRC (body), 0)) == SUBREG) - XEXP (SET_SRC (body), 0) - = alter_subreg (XEXP (SET_SRC (body), 0)); - if (GET_CODE (XEXP (SET_SRC (body), 1)) == SUBREG) - XEXP (SET_SRC (body), 1) - = alter_subreg (XEXP (SET_SRC (body), 1)); - } - if ((cc_status.value1 != 0 - && rtx_equal_p (SET_SRC (body), cc_status.value1)) - || (cc_status.value2 != 0 - && rtx_equal_p (SET_SRC (body), cc_status.value2))) + rtx set = single_set(insn); + + if (set + && GET_CODE (SET_DEST (set)) == CC0 + && insn != last_ignored_compare) { - /* Don't delete insn if it has an addressing side-effect. */ - if (! FIND_REG_INC_NOTE (insn, 0) - /* or if anything in it is volatile. */ - && ! volatile_refs_p (PATTERN (insn))) + if (GET_CODE (SET_SRC (set)) == SUBREG) + SET_SRC (set) = alter_subreg (SET_SRC (set)); + else if (GET_CODE (SET_SRC (set)) == COMPARE) { - /* We don't really delete the insn; just ignore it. */ - last_ignored_compare = insn; - break; + if (GET_CODE (XEXP (SET_SRC (set), 0)) == SUBREG) + XEXP (SET_SRC (set), 0) + = alter_subreg (XEXP (SET_SRC (set), 0)); + if (GET_CODE (XEXP (SET_SRC (set), 1)) == SUBREG) + XEXP (SET_SRC (set), 1) + = alter_subreg (XEXP (SET_SRC (set), 1)); + } + if ((cc_status.value1 != 0 + && rtx_equal_p (SET_SRC (set), cc_status.value1)) + || (cc_status.value2 != 0 + && rtx_equal_p (SET_SRC (set), cc_status.value2))) + { + /* Don't delete insn if it has an addressing side-effect. */ + if (! FIND_REG_INC_NOTE (insn, 0) + /* or if anything in it is volatile. */ + && ! volatile_refs_p (PATTERN (insn))) + { + /* We don't really delete the insn; just ignore it. */ + last_ignored_compare = insn; + break; + } } } } -- cgit v1.1