Skip to content

Commit

Permalink
PartialTuple support in getfield tfunc
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno committed Oct 5, 2018
1 parent 6e7a9e9 commit 9ab2caf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/compiler/ssair/ir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ function process_node!(compact::IncrementalCompact, result::Vector{Any},
# performance turns out ok
stmt = renumber_ssa2!(stmt, ssa_rename, used_ssas, late_fixup, result_idx, do_rename_ssa)::PiNode
if !isa(stmt.val, AnySSAValue) && !isa(stmt.val, GlobalRef)
valtyp = isa(stmt.val, QuoteNode) ? typeof(stmt.val.val) : typeof(stmt.val)
valtyp = isa(stmt.val, QuoteNode) ? typeof(stmt.val.value) : typeof(stmt.val)
if valtyp === stmt.typ
ssa_rename[idx] = stmt.val
return result_idx
Expand Down
8 changes: 8 additions & 0 deletions base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,14 @@ function getfield_tfunc(@nospecialize(s00), @nospecialize(name))
end
end
s = typeof(sv)
elseif isa(s, PartialTuple)
if isa(name, Const)
nv = name.val
if isa(nv, Int) && 1 <= nv <= length(s.fields)
return s.fields[nv]
end
end
s = widenconst(s)
end
if isType(s) || !isa(s, DataType) || s.abstract
return Any
Expand Down

0 comments on commit 9ab2caf

Please sign in to comment.