aboutsummaryrefslogtreecommitdiff
path: root/cse.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2004-11-30 18:27:47 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:05:18 -0700
commit3f7c3bf7a3ce7641d695b70dd94ebe8e1470652d (patch)
tree02740624dfdaaab58d25fee5f4f457203e9a5c3a /cse.c
parentSimplify "setcc + select $0<->$1" into "setne/seteq". (diff)
downloadsparse-3f7c3bf7a3ce7641d695b70dd94ebe8e1470652d.tar.gz
sparse-3f7c3bf7a3ce7641d695b70dd94ebe8e1470652d.tar.bz2
sparse-3f7c3bf7a3ce7641d695b70dd94ebe8e1470652d.zip
Don't try to share parenthood fn between phi node removal and
regular CSE. The CSE case is totally different: since both children use the same pseudos, there can be no question that a common parent wouldn't have that pseudo live.
Diffstat (limited to 'cse.c')
-rw-r--r--cse.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/cse.c b/cse.c
index 4de950d..21ae285 100644
--- a/cse.c
+++ b/cse.c
@@ -259,6 +259,20 @@ static int bb_dominates(struct entrypoint *ep, struct basic_block *bb1, struct b
return 1;
}
+static struct basic_block *trivial_common_parent(struct basic_block *bb1, struct basic_block *bb2)
+{
+ struct basic_block *parent;
+
+ if (bb_list_size(bb1->parents) != 1)
+ return 0;
+ parent = first_basic_block(bb1->parents);
+ if (bb_list_size(bb2->parents) != 1)
+ return 0;
+ if (first_basic_block(bb2->parents) != parent)
+ return 0;
+ return parent;
+}
+
static inline void remove_instruction(struct instruction_list **list, struct instruction *insn, int count)
{
delete_ptr_list_entry((struct ptr_list **)list, insn, count);
@@ -305,7 +319,7 @@ static struct instruction * try_to_cse(struct entrypoint *ep, struct instruction
return cse_one_instruction(i1, i2);
/* No direct dominance - but we could try to find a common ancestor.. */
- common = trivial_common_parent(b1, VOID, b2, VOID);
+ common = trivial_common_parent(b1, b2);
if (common) {
i1 = cse_one_instruction(i2, i1);
remove_instruction(&b1->insns, i1, 1);