aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@codesourcery.com>2011-11-29 15:58:05 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2011-11-29 15:58:05 +0000
commit89ff14c26599fbf9eff70bc2b03287b447cfc021 (patch)
tree9ed8ffdc66f0c8e75d56bfa860fedc60e86bb452 /gcc
parent4d5ae4eadc00c0fc843735d39c56a58f0107c972 (diff)
downloadgcc-89ff14c26599fbf9eff70bc2b03287b447cfc021.zip
gcc-89ff14c26599fbf9eff70bc2b03287b447cfc021.tar.gz
gcc-89ff14c26599fbf9eff70bc2b03287b447cfc021.tar.bz2
haifa-sched.c (recompute_todo_spec): Simplify and correct the code checking for a clobber of a condition register...
* haifa-sched.c (recompute_todo_spec): Simplify and correct the code checking for a clobber of a condition register when deciding whether to predicate. From-SVN: r181806
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/haifa-sched.c39
2 files changed, 19 insertions, 26 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bf5a6a1..9a6765d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-11-29 Bernd Schmidt <bernds@codesourcery.com>
+
+ * haifa-sched.c (recompute_todo_spec): Simplify and correct the
+ code checking for a clobber of a condition register when deciding
+ whether to predicate.
+
2011-11-29 Diego Novillo <dnovillo@google.com>
* gimple.c (gimple_call_set_cannot_inline): Move from gimple.h.
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index d87a608..4db2313 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1178,33 +1178,20 @@ recompute_todo_spec (rtx next)
regno = REGNO (XEXP (cond, 0));
/* Find the last scheduled insn that modifies the condition register.
- If we have a true dependency on it, it sets it to the correct value,
- otherwise it must be a later insn scheduled in-between that clobbers
- the condition. */
- FOR_EACH_VEC_ELT_REVERSE (rtx, scheduled_insns, i, prev)
- {
- sd_iterator_def sd_it;
- dep_t dep;
- HARD_REG_SET t;
- bool found;
-
- find_all_hard_reg_sets (prev, &t);
- if (!TEST_HARD_REG_BIT (t, regno))
- continue;
+ We can stop looking once we find the insn we depend on through the
+ REG_DEP_CONTROL; if the condition register isn't modified after it,
+ we know that it still has the right value. */
+ if (QUEUE_INDEX (pro) == QUEUE_SCHEDULED)
+ FOR_EACH_VEC_ELT_REVERSE (rtx, scheduled_insns, i, prev)
+ {
+ HARD_REG_SET t;
- found = false;
- FOR_EACH_DEP (next, SD_LIST_RES_BACK, sd_it, dep)
- {
- if (DEP_PRO (dep) == prev && DEP_TYPE (dep) == REG_DEP_TRUE)
- {
- found = true;
- break;
- }
- }
- if (!found)
- return HARD_DEP;
- break;
- }
+ find_all_hard_reg_sets (prev, &t);
+ if (TEST_HARD_REG_BIT (t, regno))
+ return HARD_DEP;
+ if (prev == pro)
+ break;
+ }
if (ORIG_PAT (next) == NULL_RTX)
{
ORIG_PAT (next) = PATTERN (next);