diff options
author | dje <dje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-07 21:35:44 +0000 |
---|---|---|
committer | dje <dje@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-07 21:35:44 +0000 |
commit | 6c01453c5dbc28b1e35198faf052d290b4530288 (patch) | |
tree | dbb361dfc49d1eb1dbbd122b1260387b567b7a4b /gcc | |
parent | d35f187f792139b661c13971c79c72440411240f (diff) | |
download | gcc-6c01453c5dbc28b1e35198faf052d290b4530288.tar.gz |
* ifcvt.c (total_bb_rtx_cost): New function.
(find_if_case_1): Compare rtx_cost of basic block to cost of
BRANCH_COST insns.
(find_if_case_2): Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84233 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ifcvt.c | 26 |
2 files changed, 31 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d5e7db4ac4..87b72f91f8b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-07-07 David Edelsohn <edelsohn@gnu.org> + + * ifcvt.c (total_bb_rtx_cost): New function. + (find_if_case_1): Compare rtx_cost of basic block to cost of + BRANCH_COST insns. + (find_if_case_2): Same. + 2004-07-07 Eric Botcazou <ebotcazou@libertysurf.fr> PR target/10567 diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 03efaba2ebb..865fe1ed1a1 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -86,6 +86,7 @@ static bool life_data_ok; /* Forward references. */ static int count_bb_insns (basic_block); +static int total_bb_rtx_cost (basic_block); static rtx first_active_insn (basic_block); static rtx last_active_insn (basic_block, int); static basic_block block_fallthru (basic_block); @@ -160,6 +161,27 @@ count_bb_insns (basic_block bb) return count; } +/* Count the total rtx_cost of non-jump active insns in BB. */ + +static int +total_bb_rtx_cost (basic_block bb) +{ + int count = 0; + rtx insn = BB_HEAD (bb); + + while (1) + { + if (GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == INSN) + count += rtx_cost (PATTERN (insn), 0); + + if (insn == BB_END (bb)) + break; + insn = NEXT_INSN (insn); + } + + return count; +} + /* Return the first non-jump active insn in the basic block. */ static rtx @@ -2883,7 +2905,7 @@ find_if_case_1 (basic_block test_bb, edge then_edge, edge else_edge) test_bb->index, then_bb->index); /* THEN is small. */ - if (count_bb_insns (then_bb) > BRANCH_COST) + if (total_bb_rtx_cost (then_bb) >= COSTS_N_INSNS (BRANCH_COST)) return FALSE; /* Registers set are dead, or are predicable. */ @@ -2974,7 +2996,7 @@ find_if_case_2 (basic_block test_bb, edge then_edge, edge else_edge) test_bb->index, else_bb->index); /* ELSE is small. */ - if (count_bb_insns (else_bb) > BRANCH_COST) + if (total_bb_rtx_cost (else_bb) >= COSTS_N_INSNS (BRANCH_COST)) return FALSE; /* Registers set are dead, or are predicable. */ |