Skip to content

Commit

Permalink
Skip tests obsoleted by inference improvements (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored Jan 22, 2022
1 parent a66e9f7 commit 2ff6c69
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
9 changes: 8 additions & 1 deletion test/snoopi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@ uncompiled(x) = x + 1
@test any(str->occursin("kwftype", str), FK)
@test !any(str->occursin(r"Type\{NamedTuple.*typeof\(sin\)", str), FK)
if VERSION >= v"1.4.0-DEV.215"
@test any(str->occursin("__lookup_kwbody__", str), FK)
mis = last.(tinf)
if !isempty(filter(mis) do mi
length(mi.specTypes.parameters) >= 2 && mi.specTypes.parameters[end-1] === typeof(sortperm) && !(mi.specTypes.parameters[2] <: NamedTuple)
end)
@test any(str->occursin("__lookup_kwbody__", str), FK)
else
@warn "Body method was not toplevel-inferred, test skipped"
end
else
@test any(str->occursin("isdefined", str), FK)
end
Expand Down
27 changes: 19 additions & 8 deletions test/snoopi_deep.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,16 @@ end
@noinline callf(@nospecialize(f::Function), x) = f(x)
g(x) = callf(sqrt, x)
end
cats = categories(@snoopi_deep M.g(3))
@test cats == [SnoopCompile.FromTestCallee, SnoopCompile.CallerInlineable, SnoopCompile.Invoke]
SnoopCompile.show_suggest(io, cats, nothing, nothing)
@test occursin(r"invoked callee.*may fail to precompile", String(take!(io)))
tinf = @snoopi_deep M.g(3)
itrigs = inference_triggers(tinf)
if !isempty(itrigs)
cats = categories(tinf)
@test cats == [SnoopCompile.FromTestCallee, SnoopCompile.CallerInlineable, SnoopCompile.Invoke]
SnoopCompile.show_suggest(io, cats, nothing, nothing)
@test occursin(r"invoked callee.*may fail to precompile", String(take!(io)))
else
@warn "Skipped Invoke test due to improvements in inference"
end

# FromInvokeLatest
M = Module()
Expand Down Expand Up @@ -477,10 +483,15 @@ end
Base.show(io::IO, ::BType) = print(io, "B")
@noinline doprint(ref) = print(IOBuffer(), "a", ref[], 3.2)
end
cats = categories(@snoopi_deep M.doprint(Ref{Union{M.AType,M.BType}}(M.AType())))
@test cats == [SnoopCompile.FromTestCallee, SnoopCompile.InvokedCalleeVararg]
SnoopCompile.show_suggest(io, cats, nothing, nothing)
@test occursin(r"invoked callee is varargs.*homogenize", String(take!(io)))
tinf = @snoopi_deep M.doprint(Ref{Union{M.AType,M.BType}}(M.AType()))
if !isempty(inference_triggers(tinf))
cats = categories(tinf)
@test cats == [SnoopCompile.FromTestCallee, SnoopCompile.InvokedCalleeVararg]
SnoopCompile.show_suggest(io, cats, nothing, nothing)
@test occursin(r"invoked callee is varargs.*homogenize", String(take!(io)))
else
@warn "Skipped InvokeCalleeVararg test due to improvements in inference"
end

# Vararg that resolves to a UnionAll
M = Module()
Expand Down
4 changes: 3 additions & 1 deletion test/snoopr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ end
invs = @snoopr (::Type{T})(x::SnooprTests.MyInt) where T<:Integer = T(x.x)
umis1 = uinvalidated(invs)
umis2 = uinvalidated(invs; exclude_corecompiler=false)
@test length(umis2) > length(umis1) + 20
if Base.VERSION < v"1.8.0-DEV"
@test length(umis2) > length(umis1) + 20
end

# recursive filtermod
list = Union{Int,String}[1,2]
Expand Down

0 comments on commit 2ff6c69

Please sign in to comment.