Skip to content

Commit b0591f2

Browse files
limepoutinethewilsonator
authored andcommitted
Unconditionally scan the callee before inline cost computation
1 parent 4264da7 commit b0591f2

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

compiler/src/dmd/inline.d

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,7 @@ public:
15811581
*/
15821582
if (auto pe = e.isPtrExp())
15831583
{
1584-
if (pe.e1.isVarExp())
1584+
if (pe.e1.isVarExp() || pe.e1.isFuncExp())
15851585
e = pe.e1;
15861586
else if (auto se = pe.e1.isSymOffExp())
15871587
return se.var.isFuncDeclaration();
@@ -2089,6 +2089,8 @@ private bool canInline(FuncDeclaration fd, bool hasThis, bool statementsToo, PAS
20892089
}
20902090

20912091
{
2092+
scope v = new InlineScanVisitorDsymbol(pass, eSink);
2093+
fd.accept(v);
20922094
cost = inlineCostFunction(fd, hasThis);
20932095
}
20942096
static if (CANINLINE_LOG)
@@ -2106,11 +2108,6 @@ private bool canInline(FuncDeclaration fd, bool hasThis, bool statementsToo, PAS
21062108
else
21072109
fd.inlineStatusExp = ILS.yes;
21082110

2109-
{
2110-
scope v = new InlineScanVisitorDsymbol(pass, eSink);
2111-
fd.accept(v);
2112-
}
2113-
21142111
if (fd.inlineStatusExp == ILS.uninitialized)
21152112
{
21162113
// Need to redo cost computation, as some statements or expressions have been inlined

0 commit comments

Comments
 (0)