Skip to content

Commit

Permalink
fix regression introduced in #44231 (#44638)
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub authored Mar 17, 2022
1 parent 7ce6a5e commit b9b2a3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1811,11 +1811,11 @@ function builtin_effects(f::Builtin, argtypes::Vector{Any}, rt)
nothrow = isvarargtype(argtypes[end]) ? false :
builtin_nothrow(f, argtypes[2:end], rt)
end
effect_free = f === isdefined
effect_free = true
elseif f === getglobal && length(argtypes) >= 3
nothrow = effect_free = getglobal_nothrow(argtypes[2:end])
nothrow = getglobal_nothrow(argtypes[2:end])
ipo_consistent = nothrow && isconst((argtypes[2]::Const).val, (argtypes[3]::Const).val)
#effect_free = nothrow && isbindingresolved((argtypes[2]::Const).val, (argtypes[3]::Const).val)
effect_free = true
else
ipo_consistent = contains_is(_CONSISTENT_BUILTINS, f)
effect_free = contains_is(_EFFECT_FREE_BUILTINS, f) || contains_is(_PURE_BUILTINS, f)
Expand Down
3 changes: 3 additions & 0 deletions test/compiler/irpasses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -831,3 +831,6 @@ let ci = code_typed(foo_cfg_empty, Tuple{Bool}, optimize=true)[1][1]
@test length(ir.cfg.blocks) <= 2
@test isa(ir.stmts[length(ir.stmts)][:inst], ReturnNode)
end

@test Core.Compiler.builtin_effects(getfield, Any[Complex{Int}, Symbol], Any).effect_free.state == 0x01
@test Core.Compiler.builtin_effects(getglobal, Any[Module, Symbol], Any).effect_free.state == 0x01

0 comments on commit b9b2a3c

Please sign in to comment.