aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Edelsohn <edelsohn@gnu.org>2004-07-07 21:35:44 +0000
committerDavid Edelsohn <dje@gcc.gnu.org>2004-07-07 17:35:44 -0400
commit252910550c943c45e2868295360465a121144795 (patch)
treedbb361dfc49d1eb1dbbd122b1260387b567b7a4b /gcc
parent951661a1a5a4271ba4975cde0f0093af99861acf (diff)
downloadgcc-252910550c943c45e2868295360465a121144795.zip
gcc-252910550c943c45e2868295360465a121144795.tar.gz
gcc-252910550c943c45e2868295360465a121144795.tar.bz2
ifcvt.c (total_bb_rtx_cost): New function.
* 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. From-SVN: r84233
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/ifcvt.c26
2 files changed, 31 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7d5e7db..87b72f9 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 03efaba..865fe1e 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. */