From: David Given Date: Mon, 12 Dec 2016 22:45:13 +0000 (+0100) Subject: Always insert phis, even if we don't technically need one (saves time later). X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=b4253a9eddf6208ea47ad4916aa7f7cc74c6bbb1;p=ack.git Always insert phis, even if we don't technically need one (saves time later). --- diff --git a/mach/proto/mcg/pass_convertstackops.c b/mach/proto/mcg/pass_convertstackops.c index 49da42226..f9bf472e2 100644 --- a/mach/proto/mcg/pass_convertstackops.c +++ b/mach/proto/mcg/pass_convertstackops.c @@ -97,29 +97,17 @@ static void convert_block(struct basicblock* bb) struct ir* ir = pops.item[i].right; assert(pushes.count > 0); - if (pushes.count == 1) - { - /* The push happened in exactly one place; that means we don't need a phi and can - * just import the value directly. */ - struct ir* src = pushes.item[0].right; - ir->opcode = IR_NOP; - ir->left = src; - } - else + struct ir* phi = new_ir0(IR_PHI, ir->size); + for (j=0; jsize); - for (j=0; ju.phivalue, - pushes.item[j].left, - pushes.item[j].right); - } - phi->root = phi; - *ir = *phi; + pmap_add(&phi->u.phivalue, + pushes.item[j].left, + pushes.item[j].right); } + phi->root = phi; + phi->bb = ir->bb; + *ir = *phi; } } }