Skip to content

Commit

Permalink
fix getglobal_nothrow (JuliaLang#44855)
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub committed Apr 5, 2022
1 parent f8f83da commit 7a61fc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ end
function getglobal_nothrow(argtypes::Vector{Any})
2 length(argtypes) 3 || return false
if length(argtypes) == 3
global_order_nothrow(o, true, false) || return false
global_order_nothrow(argtypes[3], true, false) || return false
end
M, s = argtypes
if M isa Const && s isa Const
Expand Down
10 changes: 9 additions & 1 deletion test/compiler/inline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function f_div(x)
div(x, 1)
return x
end
@test fully_eliminated(f_div, (Int,)) == 1
@test fully_eliminated(f_div, (Int,); retval=Core.Argument(2))
# ...unless we div by an unknown amount
function f_div(x, y)
div(x, y)
Expand Down Expand Up @@ -1234,3 +1234,11 @@ g_call_peel(x) = f_peel(x)
let src = code_typed1(g_call_peel, Tuple{Any})
@test count(isinvoke(:f_peel), src.code) == 2
end

const my_defined_var = 42
@test fully_eliminated((); retval=42) do
getglobal(@__MODULE__, :my_defined_var, :monotonic)
end
@test !fully_eliminated() do
getglobal(@__MODULE__, :my_defined_var, :foo)
end

0 comments on commit 7a61fc0

Please sign in to comment.