From 51bd3ee4dd0aa7d83494f03fc7d836699dbee54a Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 27 Oct 2016 21:40:25 +0200 Subject: [PATCH] Fix bug where some phis weren't being inserted when a given variable definition needed more than one phi (due to the dominance frontier containing more than one basic block). --- mach/proto/mcg/pass_ssa.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mach/proto/mcg/pass_ssa.c b/mach/proto/mcg/pass_ssa.c index 260ad9294..e0f835f17 100644 --- a/mach/proto/mcg/pass_ssa.c +++ b/mach/proto/mcg/pass_ssa.c @@ -185,12 +185,16 @@ static void ssa_convert(void) for (i=0; ioffset, bb->name); + for (j=0; joffset, dominates->name); + if (dominancefrontiers.item[j].left == bb) + { + struct basicblock* dominates = dominancefrontiers.item[j].right; + array_appendu(&needsphis, dominates); + array_appendu(&defining, dominates); + tracef('S', "S: local %d needs phi in block %s\n", current_local->offset, dominates->name); + } } }