@@ -439,6 +439,7 @@ void rewrite_load_instruction(struct instruction *insn, struct instruction_list
struct ident *ident)
{
struct pseudo_list *dominators;
+ struct instruction *dom;
pseudo_t new, phi;
dominators = add_load_dominators(insn, doms, ident);
@@ -447,12 +448,12 @@ void rewrite_load_instruction(struct instruction *insn, struct instruction_list
* Check for somewhat common case of duplicate
* phi nodes.
*/
- new = first_pseudo(dominators)->def->src1;
- FOR_EACH_PTR(dominators, phi) {
- if (new != phi->def->src1)
+ new = first_instruction(doms)->target;
+ FOR_EACH_PTR(doms, dom) {
+ if (new != dom->target)
goto complex_phi;
- new->ident = new->ident ? : phi->ident;
- } END_FOR_EACH_PTR(phi);
+ new->ident = new->ident ? : ident ? : dom->target->ident;
+ } END_FOR_EACH_PTR(dom);
/*
* All the same pseudo - mark the phi-nodes unused
Now that add_load_dominators() is integrated into rewrite_load_instruction() we can check for duplicated phi sources directly in the dominators list instead to have to check the corresponding phi sources. This is a preparatory step for the next patch where unneeded phi sources are not created anymore. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- flow.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)