On 11/28/14 02:31, Eric Botcazou wrote:
Hi,

this patch fixes a few glitches in the post-reload compare elimination pass,
most notably the slightly disturbing opening comment:

    This pass assumes:

[...]

    (1) All comparison patterns are represented as

        [(set (reg:CC) (compare:CC (reg) (immediate)))]

the mode mismatch in before_dom_children:

                rtx x, flags = gen_rtx_REG (src_mode, targetm.flags_regnum);

                /* Generate new comparison for substitution.  */
                x = gen_rtx_COMPARE (new_mode, XEXP (src, 0), XEXP (src, 1));
                x = gen_rtx_SET (VOIDmode, flags, x);

and the direct tests on flag_non_call_exceptions:

          if (flag_non_call_exceptions)
            eh_note = find_reg_note (insn, REG_EH_REGION, NULL);

[...]

          /* Take care that it's in the same EH region.  */
          if (flag_non_call_exceptions
              && !rtx_equal_p (eh_note, last_cmp->eh_note))
            goto dont_delete;

It also factors out the comparison logic in before_dom_children to avoid the
series of gotos.

Tested on a private port we're about to submit, OK for the mainline?


2014-11-28  Eric Botcazou  <ebotca...@adacore.com>

        * compare-elim.c: Fix head comment.
        (conforming_compare): Remove redundant test.
        (can_eliminate_compare): New function extracted from...
        (before_dom_children): ...here.  Use it, replace direct uses of
        flag_non_call_exceptions and tidy up.
        (maybe_select_cc_mode): Tidy up.
OK.
jeff

Reply via email to