[m-rev.] for review: conditional structure reuse for LLDS backends

Peter Wang novalazy at gmail.com
Mon Feb 11 15:54:37 AEDT 2008

On 2008-02-11, Zoltan Somogyi <zs at csse.unimelb.edu.au> wrote:
> On Wed, 30 Jan 2008, Peter Wang wrote:
> >    /* flag_reg is non-zero iff reuse is possible */
> >    if (flag_reg) {
> > 	goto skip;
> >    }
> >    ...assign fields which don't need to be assigned in reuse case...
> >  skip:
> >    ...assign fields which must be assigned in both cases...
> >
> > It may be that it is not worth the branch to avoid assigning known fields.
> > I haven't yet checked.
> That code isn't right; there needs to be a goto after the first set of
> assignments, otherwise you assign to many fields twice.

No, the code before the label doesn't include any of the assignments
that come after the label.

> Whether avoiding assignments to known same fields is worthwhile depends
> on how many of them there are compared to fields that need to be assigned.
> If you have (say) ten fields, and you can avoid an assignment to one,
> using the if-then-else will definitely lead to a slowdown, because
> - the code will touch the same number of cache blocks anyway, and therefore
> - even a small percentage of mispredicted branches will cost more than you
>   can possibly save.
> On the other hand, if you can avoid assignments to nine out ten fields,
> the if-then-else may be worthwhile.
> So if you want to test this, do it with a tunable parameter, e.g. one
> that gives what percentage of field assignments you need to be able avoid
> before resorting to the if-then-else.

It's on the list.


mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au

More information about the reviews mailing list