Skip to content

Commit

Permalink
fix inlining cost of IntrinsicFunctions when consts have been widened
Browse files Browse the repository at this point in the history
along with the llvmcall fix, this fixes #28078
  • Loading branch information
JeffBezanson committed Jul 19, 2018
1 parent c9a53ae commit f29ab20
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,16 @@ function statement_cost(ex::Expr, line::Int, src::CodeInfo, spvals::SimpleVector
if is_meta_expr_head(head)
return 0
elseif head === :call
ftyp = argextype(ex.args[1], src, spvals, slottypes)
farg = ex.args[1]
ftyp = argextype(farg, src, spvals, slottypes)
if ftyp === IntrinsicFunction && farg isa SSAValue
# if this comes from code that was already inlined into another function,
# Consts have been widened. try to recover in simple cases.
farg = src.code[farg.id]
if isa(farg, GlobalRef) || isa(farg, QuoteNode) || isa(farg, IntrinsicFunction) || isexpr(farg, :static_parameter)
ftyp = argextype(farg, src, spvals, slottypes)
end
end
f = singleton_type(ftyp)
if isa(f, IntrinsicFunction)
iidx = Int(reinterpret(Int32, f::IntrinsicFunction)) + 1
Expand Down

0 comments on commit f29ab20

Please sign in to comment.