diff options
| author | Roland Paterson-Jones <[email protected]> | 2024-11-19 11:11:30 +0200 |
|---|---|---|
| committer | Quentin Carbonneaux <[email protected]> | 2025-03-14 09:47:05 +0100 |
| commit | ecfdac4f00a81dd57ffcbe11142e8619b1f2ee67 (patch) | |
| tree | b5daeaba058422a4b74d073d8c6cb2d9d71b0d0c | |
| parent | 1c769584ac42bb821e859f9ac2a5a4010ed49df1 (diff) | |
Simplify fillpreds()
Now that b->pred is a vector we do can remove the counting pass.
| -rw-r--r-- | cfg.c | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -45,12 +45,12 @@ edgedel(Blk *bs, Blk **pbd) static void addpred(Blk *bp, Blk *bc) { + ++bc->npred; if (bc->pred) vgrow(&bc->pred, bc->npred); else bc->pred = vnew(bc->npred, sizeof bc->pred[0], PFn); - assert(bc->visit < bc->npred); - bc->pred[bc->visit++] = bp; + bc->pred[bc->npred-1] = bp; } /* fill predecessors information in blocks */ @@ -59,16 +59,8 @@ fillpreds(Fn *f) { Blk *b; - for (b=f->start; b; b=b->link) { + for (b=f->start; b; b=b->link) b->npred = 0; - b->visit = 0; - } - for (b=f->start; b; b=b->link) { - if (b->s1) - b->s1->npred++; - if (b->s2 && b->s2 != b->s1) - b->s2->npred++; - } for (b=f->start; b; b=b->link) { if (b->s1) addpred(b, b->s1); |
