diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-11-30 18:27:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:05:18 -0700 |
commit | 3f7c3bf7a3ce7641d695b70dd94ebe8e1470652d (patch) | |
tree | 02740624dfdaaab58d25fee5f4f457203e9a5c3a | |
parent | Simplify "setcc + select $0<->$1" into "setne/seteq". (diff) | |
download | sparse-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.
-rw-r--r-- | cse.c | 16 | ||||
-rw-r--r-- | flow.h | 3 | ||||
-rw-r--r-- | simplify.c | 14 |
3 files changed, 17 insertions, 16 deletions
@@ -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); @@ -30,7 +30,4 @@ extern void track_pseudo_liveness(struct entrypoint *ep); extern void vrfy_flow(struct entrypoint *ep); extern int pseudo_in_list(struct pseudo_list *list, pseudo_t pseudo); -extern struct basic_block *trivial_common_parent(struct basic_block *, pseudo_t, - struct basic_block *, pseudo_t); - #endif @@ -25,16 +25,6 @@ static struct basic_block *phi_parent(struct basic_block *source, pseudo_t pseud return first_basic_block(source->parents); } -struct basic_block *trivial_common_parent(struct basic_block *s1, pseudo_t p1, - struct basic_block *s2, pseudo_t p2) -{ - s1 = phi_parent(s1, p1); - s2 = phi_parent(s2, p2); - if (s1 != s2) - s1 = NULL; - return s1; -} - static void clear_phi(struct instruction *insn) { pseudo_t phi; @@ -71,8 +61,8 @@ static int if_convert_phi(struct instruction *insn) /* * See if we can find a common source for this.. */ - source = trivial_common_parent(bb1, p1, bb2, p2); - if (!source) + source = phi_parent(bb1, p1); + if (source != phi_parent(bb2, p2)) return 0; /* |