diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2007-03-29 12:04:09 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2007-03-29 12:04:09 +0000 |
commit | cab6e7717eff3872849ef593073e9e3a6ad47956 (patch) | |
tree | bb9d8684fd23c1a34a7634ee37863dc889f5b85e /gcc | |
parent | ed31d14cafee6f62692ed62e1ca295aa9b1b65ee (diff) | |
download | gcc-cab6e7717eff3872849ef593073e9e3a6ad47956.zip gcc-cab6e7717eff3872849ef593073e9e3a6ad47956.tar.gz gcc-cab6e7717eff3872849ef593073e9e3a6ad47956.tar.bz2 |
ifcvt.c (struct noce_if_info): Add then_else_reversed field.
* ifcvt.c (struct noce_if_info): Add then_else_reversed field.
(noce_get_alt_condition): Look at it to determine whether to
reverse the condition or not.
(noce_get_condition): Substitute the truth for lies.
(noce_find_if_block): Set the then_else_reversed field.
From-SVN: r123327
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ifcvt.c | 22 |
2 files changed, 24 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c024168..ed51488 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2007-03-29 Steven Bosscher <steven@gcc.gnu.org> + + * ifcvt.c (struct noce_if_info): Add then_else_reversed field. + (noce_get_alt_condition): Look at it to determine whether to + reverse the condition or not. + (noce_get_condition): Substitute the truth for lies. + (noce_find_if_block): Set the then_else_reversed field. + 2007-03-29 Lars Poeschel <larsi@wh2.tu-dresden.de> * config/fr30/fr30.md (movdi): Do not accept immediates as the diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index f5f73f4..4a993d3 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -621,6 +621,12 @@ struct noce_if_info /* The SET_DEST of INSN_A. */ rtx x; + + /* True if this if block is not canonical. In the canonical form of + if blocks, the THEN_BB is the block reached via the fallthru edge + from TEST_BB. For the noce transformations, we allow the symmetric + form as well. */ + bool then_else_reversed; }; static rtx noce_emit_store_flag (struct noce_if_info *, rtx, int, int); @@ -1503,6 +1509,8 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target, reverse = GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF && XEXP (XEXP (SET_SRC (set), 2), 0) == JUMP_LABEL (if_info->jump); + if (if_info->then_else_reversed) + reverse = !reverse; /* If we're looking for a constant, try to make the conditional have that constant in it. There are two reasons why it may @@ -2017,8 +2025,8 @@ noce_try_bitop (struct noce_if_info *if_info) /* Similar to get_condition, only the resulting condition must be valid at JUMP, instead of at EARLIEST. - If THEN_ELSE_REVERSED is true, the fallthrough goes to the THEN - block of the caller, and we have to reverse the condition. */ + If THEN_ELSE_REVERSED is true, the fallthrough does not go to the + THEN block of the caller, and we have to reverse the condition. */ static rtx noce_get_condition (rtx jump, rtx *earliest, bool then_else_reversed) @@ -2036,8 +2044,9 @@ noce_get_condition (rtx jump, rtx *earliest, bool then_else_reversed) reverse = (GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF && XEXP (XEXP (SET_SRC (set), 2), 0) == JUMP_LABEL (jump)); - /* We may have to reverse because the caller's if block is not canonical - (i.e. the ELSE block isn't the fallthrough block for the TEST block). */ + /* We may have to reverse because the caller's if block is not canonical, + i.e. the THEN block isn't the fallthrough block for the TEST block + (see find_if_header). */ if (then_else_reversed) reverse = !reverse; @@ -2671,7 +2680,7 @@ noce_find_if_block (basic_block test_bb, /* Recognize an IF-ELSE-JOIN block. We can have those because the order of basic blocks in cfglayout mode does not matter, so the fallthrough edge can go to any basic block (and not just to bb->next_bb, like in - cfgrtl mode). */ + cfgrtl mode). */ else if (single_pred_p (else_edge->dest) && single_succ_p (else_edge->dest) && single_succ (else_edge->dest) == then_edge->dest) @@ -2687,7 +2696,7 @@ noce_find_if_block (basic_block test_bb, else /* Not a form we can handle. */ return FALSE; - + /* The edges of the THEN and ELSE blocks cannot have complex edges. */ if (single_succ_edge (then_bb)->flags & EDGE_COMPLEX) return FALSE; @@ -2735,6 +2744,7 @@ noce_find_if_block (basic_block test_bb, if_info.join_bb = join_bb; if_info.cond = cond; if_info.jump = jump; + if_info.then_else_reversed = then_else_reversed; /* Do the real work. */ |