Skip to content

Commit 82e3897

Browse files
authored
make llvmcall search logic more robust (#679)
1 parent d66c5b9 commit 82e3897

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/optimize.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ function lookup_stmt(stmts::Vector{Any}, @nospecialize arg)
1515
# :(Base.getproperty(%1, :Intrinsics))
1616
# :(Base.getproperty(%2, :llvmcall))
1717
q = arg.args[3]
18-
if isa(q, QuoteNode) && isa(q.value, Symbol)
18+
if isa(q, QuoteNode) && (qval = q.value; qval isa Symbol)
1919
mod = lookup_stmt(stmts, arg.args[2])
2020
if isa(mod, GlobalRef)
2121
mod = @invokelatest getglobal(mod.mod, mod.name)
2222
end
23-
isa(mod, Module) && return @invokelatest getglobal(mod, q.value)
23+
if isa(mod, Module)
24+
if @invokelatest isdefinedglobal(mod, qval)
25+
return @invokelatest getglobal(mod, qval)
26+
end
27+
end
2428
end
2529
end
2630
return arg

0 commit comments

Comments
 (0)