Skip to content

Commit 6584816

Browse files
authored
Attributes for jl_typeof (#2406)
* attributes for jl_typeof * add dummy-test for jl_typeof * move test to runtime_calls.jl
1 parent 7a24937 commit 6584816

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/llvm/attributes.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const nofreefns = Set{String}((
2+
"jl_typeof",
23
"julia.gc_loaded",
34
"jl_egal__unboxed", "ijl_egal__unboxed",
45
"jl_restore_excstack",
@@ -158,6 +159,7 @@ const nofreefns = Set{String}((
158159
))
159160

160161
const inactivefns = Set{String}((
162+
"jl_typeof",
161163
"jl_egal__unboxed", "ijl_egal__unboxed",
162164
"ClientGetDevice",
163165
"BufferOnCPU",

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ include("typetree.jl")
7676
include("passes.jl")
7777
include("optimize.jl")
7878
include("make_zero.jl")
79+
include("runtime_calls.jl")
7980

8081
include("rules.jl")
8182
include("rrules.jl")

test/runtime_calls.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@testset "jl_typeof" begin
2+
# https://github.com/EnzymeAD/Enzyme.jl/issues/2405
3+
function foo(x)
4+
@ccall jl_typeof(Ref(x)::Ref{Float64})::Nothing
5+
x + 1
6+
end
7+
@test autodiff(Reverse, foo, Active(1.0))[1][1] == 1.0
8+
end

0 commit comments

Comments
 (0)