Skip to content

Commit

Permalink
fix getfield calls getting left in statement position
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed May 27, 2016
1 parent 5a0db0b commit 56d4927
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ function effect_free(e::ANY, sv, allow_volatile::Bool)
if isa(e,Symbol)
return allow_volatile
end
if isa(e,Number) || isa(e,AbstractString) || isa(e,SSAValue) ||
if isa(e,Number) || isa(e,AbstractString) || isa(e,SSAValue) || isa(e,Module) ||
isa(e,QuoteNode) || isa(e,Type) || isa(e,Tuple)
return true
end
Expand All @@ -2117,6 +2117,9 @@ function effect_free(e::ANY, sv, allow_volatile::Bool)
if is_known_call(e, arrayref, sv) || is_known_call(e, arraylen, sv)
return false
elseif is_known_call(e, getfield, sv)
if isType(e.typ) && isleaftype(e.typ)
return true
end
# arguments must be immutable to ensure e is affect_free
first = true
for a in ea
Expand Down

0 comments on commit 56d4927

Please sign in to comment.