Skip to content

Commit d03808b

Browse files
committed
fix regression introduced in #44231
ref #44231 (comment)
1 parent 515a242 commit d03808b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

base/compiler/tfuncs.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,11 +1811,11 @@ function builtin_effects(f::Builtin, argtypes::Vector{Any}, rt)
18111811
nothrow = isvarargtype(argtypes[end]) ? false :
18121812
builtin_nothrow(f, argtypes[2:end], rt)
18131813
end
1814-
effect_free = f === isdefined
1814+
effect_free = true
18151815
elseif f === getglobal && length(argtypes) >= 3
1816-
nothrow = effect_free = getglobal_nothrow(argtypes[2:end])
1816+
nothrow = getglobal_nothrow(argtypes[2:end])
18171817
ipo_consistent = nothrow && isconst((argtypes[2]::Const).val, (argtypes[3]::Const).val)
1818-
#effect_free = nothrow && isbindingresolved((argtypes[2]::Const).val, (argtypes[3]::Const).val)
1818+
effect_free = true
18191819
else
18201820
ipo_consistent = contains_is(_CONSISTENT_BUILTINS, f)
18211821
effect_free = contains_is(_EFFECT_FREE_BUILTINS, f) || contains_is(_PURE_BUILTINS, f)

test/compiler/irpasses.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,3 +831,6 @@ let ci = code_typed(foo_cfg_empty, Tuple{Bool}, optimize=true)[1][1]
831831
@test length(ir.cfg.blocks) <= 2
832832
@test isa(ir.stmts[length(ir.stmts)][:inst], ReturnNode)
833833
end
834+
835+
@test Core.Compiler.builtin_effects(getfield, Any[Complex{Int}, Symbol], Any).effect_free.state == 0x01
836+
@test Core.Compiler.builtin_effects(getglobal, Any[Module, Symbol], Any).effect_free.state == 0x01

0 commit comments

Comments
 (0)