Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Compiler/src/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,8 @@ function codeinfo_for_const(interp::AbstractInterpreter, mi::MethodInstance, @no
tree.ssaflags = [IR_FLAG_NULL]
tree.rettype = Core.Typeof(val)
tree.edges = Core.svec()
tree.nargs = UInt(nargs)
tree.isva = method.isva
set_inlineable!(tree, true)
tree.parent = mi
return tree
Expand Down
12 changes: 12 additions & 0 deletions Compiler/test/ssair.jl
Original file line number Diff line number Diff line change
Expand Up @@ -838,3 +838,15 @@ end
let ir = Base.code_ircode(_worker_task57153, (), optimize_until="CC: COMPACT_2")[1].first
@test findfirst(x->x==0, ir.cfg.blocks[1].preds) !== nothing
end

# codeinfo_for_const should set nargs and isva
let
_const_return_func(@nospecialize(x)) = 42
mi = Compiler.specialize_method(only(methods(_const_return_func)), Tuple{typeof(_const_return_func), Int}, Core.svec())
ci = Compiler.codeinfo_for_const(Compiler.NativeInterpreter(), mi, 42)
@test ci.nargs == 2
@test ci.isva == false
# inflate_ir! should succeed now that nargs/isva are set
ir = Compiler.inflate_ir!(ci, mi)
@test ir isa Compiler.IRCode
end