diff --git a/base/compiler/tfuncs.jl b/base/compiler/tfuncs.jl index df1861e20c206..0807989f1aa47 100644 --- a/base/compiler/tfuncs.jl +++ b/base/compiler/tfuncs.jl @@ -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) diff --git a/test/compiler/irpasses.jl b/test/compiler/irpasses.jl index 128fd6cc84b7b..38f60b0fd12aa 100644 --- a/test/compiler/irpasses.jl +++ b/test/compiler/irpasses.jl @@ -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