Skip to content

Commit

Permalink
optimizer: fix bad normalization of typeassert on a global
Browse files Browse the repository at this point in the history
GlobalRef should probably be required to be in statement position, but
presently this just needs to be handled correctly.
  • Loading branch information
vtjnash committed Feb 5, 2021
1 parent e20cd2e commit eaaace0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions base/compiler/ssair/passes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,12 @@ function getfield_elim_pass!(ir::IRCode)
# Also, we should probably have a version of typeassert
# that's defined not to return its value to make life easier
# for the backend.
pi = insert_node_here!(compact,
PiNode(stmt.args[2], compact.result[idx][:type]),
compact.result[idx][:type],
compact.result[idx][:line], true)
compact.ssa_rename[compact.idx-1] = pi
Y = stmt.args[2]
if !isa(Y, GlobalRef)
desc = compact.result[idx]
pi = insert_node_here!(compact, PiNode(Y, desc[:type]), desc[:type], desc[:line], true)
compact.ssa_rename[compact.idx-1] = pi
end
continue
elseif is_known_call(stmt, (===), compact)
c1 = compact_exprtype(compact, stmt.args[2])
Expand Down

0 comments on commit eaaace0

Please sign in to comment.