Skip to content

Commit

Permalink
restore line number filtering when inlining very small functions. helps
Browse files Browse the repository at this point in the history
#13725

Single expression functions tend to get inlined into the middle of an
expression, so their line numbers should not be inserted into the outer function
(the number applies to only part of an expression, not the whole statement).

This also significantly reduces sysimg size.
  • Loading branch information
JeffBezanson committed Oct 26, 2015
1 parent d0b97f3 commit 2155f60
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,14 @@ function inlineable(f::ANY, e::Expr, atype::ANY, sv::StaticVarInfo, enclosing_as
expr = lastexpr.args[1]
end

if length(stmts) == 1
# remove line number when inlining a single expression. see issue #13725
s = stmts[1]
if isa(s,Expr)&&is(s.head,:line) || isa(s,LineNumberNode)
pop!(stmts)
end
end

if isa(expr,Expr)
old_t = e.typ
if old_t <: expr.typ
Expand Down

0 comments on commit 2155f60

Please sign in to comment.