qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit 3b708f506f5b5b45b5cc22493595a31e7183b620
parent 7d36a71a2287e28312403ab12a6ca5b49c7a73b0
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Thu, 20 Aug 2015 13:49:49 -0400

use loop frequency in ties of rpo

Diffstat:
Mlisc/ssa.c | 16+++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lisc/ssa.c b/lisc/ssa.c @@ -44,13 +44,19 @@ fillpreds(Fn *f) static int rporec(Blk *b, int x) { - if (b->id >= 0) + Blk *s1, *s2; + + if (!b || b->id >= 0) return x; b->id = 1; - if (b->s2) - x = rporec(b->s2, x); - if (b->s1) - x = rporec(b->s1, x); + s1 = b->s1; + s2 = b->s2; + if (s1 && s2 && s1->loop > s2->loop) { + s1 = b->s2; + s2 = b->s1; + } + x = rporec(s1, x); + x = rporec(s2, x); b->id = x; assert(x >= 0); return x - 1;