D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3793 - Functions with static arrays as arguments are not inlined
Summary: Functions with static arrays as arguments are not inlined
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 minor
Assignee: No Owner
URL:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2010-02-11 07:34 UTC by Clemens
Modified: 2014-02-15 02:44 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Clemens 2010-02-11 07:34:57 UTC
Was just browsing through some front end code and found this bit of code in canInline() in inline.c:

    /* If any parameters are Tsarray's (which are passed by reference)
     * or out parameters (also passed by reference), don't do inlining.
     */
    if (parameters)
    {
	for (int i = 0; i < parameters->dim; i++)
	{
	    VarDeclaration *v = (VarDeclaration *)parameters->data[i];
	    if (v->isOut() || v->isRef() || v->type->toBasetype()->ty == Tsarray)
		goto Lno;
	}
    }

The comment, as far as I can see, is obsolete since static arrays are now value types? Perhaps this restriction can be lifted now? Especially for functions on small vectors, I would expect inlining to be very beneficial.

Just putting this here to have it not overlooked.
Comment 1 Clemens 2010-06-09 02:12:59 UTC
Seems to have been fixed in Changeset [497].