[dmd-internals] dmd commit, revision 821

Don Clugston dclugston at googlemail.com
Mon Dec 27 01:39:26 PST 2010


On 27 December 2010 09:01, Brad Roberts <braddr at puremagic.com> wrote:
> Would this alternative be better (totally untested)?
>
> // Each pass through the loop can reduce only one level of comma expression.
> // The infinite loop check needs to take this into account.
> int iterationLimit = 200;
> for (b = startblock; b; b = b->Bnext)
> {
>    if (!b->Belem)
>        continue;
>    int d = el_countCommas(b->Belem);
>    iterationLimit += d;
> }
>
> The justification being that each comma operator really ought to have a chance
> to be reduced, not just the first max number of commas in a single block.

No, it doesn't work like that. The optimizer drops one level of comma
expressions on _every_ expression tree in the block.
The number of iterations is determined by the maximum, not the total.
Also note that this commit does *not* affect the generated code in any
way, it's used only in an assert, to check for infinite loops in the
optimizer.

There is a further explanation in the patch I attached to the bug report.

>> bugzilla 3681 ICE(go.c): when function takes too long to optimize, only with -O.


More information about the dmd-internals mailing list