Fn::rpo is a vector

Scratching an itch - avoid unnecesary re-allocation in fillrpo()
which is called multiple times in the optimisation chain.
This commit is contained in:
Roland Paterson-Jones 2024-10-16 08:56:38 +02:00 committed by Quentin Carbonneaux
parent 327736b3a6
commit c16f7eafca

5
cfg.c
View File

@ -108,7 +108,10 @@ fillrpo(Fn *f)
b->id = -1u;
n = 1 + rporec(f->start, f->nblk-1);
f->nblk -= n;
f->rpo = alloc(f->nblk * sizeof f->rpo[0]);
if (f->rpo)
vgrow(&f->rpo, f->nblk);
else
f->rpo = vnew(f->nblk, sizeof f->rpo[0], PFn);
for (p=&f->start; (b=*p);) {
if (b->id == -1u) {
edgedel(b, &b->s1);