Skip to content

Commit

Permalink
ir: Respect GlobalRef lattice elements (#48151)
Browse files Browse the repository at this point in the history
Currently IncrementalCompact recomputes the type of globals on every iteration.
There is not much reason to do this - the type of a global cannot change.
In addition, external abstract interpreters may want to inject custom, more
precise lattice elements for globals, which should be respected.
Overall, this should be both faster and better for external absint,
though of course GlobalRefs now need to be inserted into the IR with the
correct type. If there's any callsites that don't do that, those would
have to be updated.
  • Loading branch information
Keno authored Jan 6, 2023
1 parent 1508425 commit b76fdcc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion base/compiler/ssair/ir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,6 @@ function process_node!(compact::IncrementalCompact, result_idx::Int, inst::Instr
ssa_rename[idx] = stmt
else
result[result_idx][:inst] = stmt
result[result_idx][:type] = argextype(stmt, compact)
result[result_idx][:flag] = flag
result_idx += 1
end
Expand Down
2 changes: 2 additions & 0 deletions base/compiler/ssair/irinterp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ function reprocess_instruction!(interp::AbstractInterpreter,
rt = tmeet(typeinf_lattice(interp), argextype(inst.val, ir), widenconst(inst.typ))
elseif inst === nothing
return false
elseif isa(inst, GlobalRef)
# GlobalRef is not refinable
else
ccall(:jl_, Cvoid, (Any,), inst)
error()
Expand Down

0 comments on commit b76fdcc

Please sign in to comment.