diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-11-09 17:00:57 -0500 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-11-09 17:00:57 -0500 |
commit | c81ed54562d223ab49be758075291432fe70ac58 (patch) | |
tree | 32881c1b138b321e0e95cf314100eba12da370b2 | |
parent | 34b4e56ca46f763f72c3a8ef0d892c7d5bbc7132 (diff) | |
download | roux-c81ed54562d223ab49be758075291432fe70ac58.tar.gz |
fix bug in frontier discovery
-rw-r--r-- | lisc/ssa.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lisc/ssa.c b/lisc/ssa.c index 8e65f7f..697ac83 100644 --- a/lisc/ssa.c +++ b/lisc/ssa.c @@ -148,7 +148,7 @@ filldom(Fn *fn) static int sdom(Blk *b1, Blk *b2) { - if (b1 == b2) + if (!b2 || b1 == b2) return 0; while (b2->id > b1->id) b2 = b2->idom; @@ -176,12 +176,10 @@ fillfron(Fn *fn) Blk *a, *b; for (b=fn->start; b; b=b->link) { - if (b->s1) - for (a=b; !sdom(a, b->s1); a=a->link) - addfron(a, b->s1); - if (b->s2) - for (a=b; !sdom(a, b->s2); a=a->link) - addfron(a, b->s2); + for (a=b; !sdom(a, b->s1); a=a->idom) + addfron(a, b->s1); + for (a=b; !sdom(a, b->s2); a=a->idom) + addfron(a, b->s2); } } |