Skip to content

Commit

Permalink
compute dead phi args correctly in fold
Browse files Browse the repository at this point in the history
The code computing if "the" edge of a phi
argument is live or dead was wrong. AFL
found that.
  • Loading branch information
Quentin Carbonneaux committed Apr 18, 2016
1 parent dc2b145 commit 47a0556
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fold.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ visitphi(Phi *p, int n, Fn *fn)
v = Top;
for (a=0; a<p->narg; a++) {
m = p->blk[a]->id;
dead = 1;
if (edge[m][0].dest == n)
dead = edge[m][0].dead;
else if (edge[m][1].dest == n)
dead = edge[m][1].dead;
else
die("invalid phi argument");
dead &= edge[m][0].dead;
if (edge[m][1].dest == n)
dead &= edge[m][1].dead;
if (!dead)
v = latmerge(v, latval(p->arg[a]));
}
Expand Down Expand Up @@ -121,7 +120,8 @@ visitjmp(Blk *b, int n, Fn *fn)
switch (b->jmp.type) {
case JJnz:
l = latval(b->jmp.arg);
if (l == Top || l == Bot) {
assert(l != Top);
if (l == Bot) {
edge[n][1].work = flowrk;
edge[n][0].work = &edge[n][1];
flowrk = &edge[n][0];
Expand Down

0 comments on commit 47a0556

Please sign in to comment.