From 3f7c3bf7a3ce7641d695b70dd94ebe8e1470652d Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 30 Nov 2004 18:27:47 -0700 Subject: 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. --- cse.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'cse.c') 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); -- cgit v1.2.3-65-gdbad