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).
This commit is contained in:
parent
9977ce841a
commit
51bd3ee4dd
|
@ -185,12 +185,16 @@ static void ssa_convert(void)
|
||||||
for (i=0; i<defining.count; i++)
|
for (i=0; i<defining.count; i++)
|
||||||
{
|
{
|
||||||
struct basicblock* bb = defining.item[i];
|
struct basicblock* bb = defining.item[i];
|
||||||
struct basicblock* dominates = pmap_findleft(&dominancefrontiers, bb);
|
tracef('S', "S: local %d in defined in block %s\n", current_local->offset, bb->name);
|
||||||
if (dominates)
|
for (j=0; j<dominancefrontiers.count; j++)
|
||||||
{
|
{
|
||||||
array_appendu(&needsphis, dominates);
|
if (dominancefrontiers.item[j].left == bb)
|
||||||
array_appendu(&defining, dominates);
|
{
|
||||||
tracef('S', "S: local %d needs phi in block %s\n", current_local->offset, dominates->name);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue