Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OptAnalyzer: ignore reports from const-prop when concrete-evaled already #561

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Example = "7876af07-990d-54b4-ab0e-23690620f79a"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "BenchmarkTools", "Example", "Libdl", "Logging", "Random", "Test"]
test = ["Aqua", "BenchmarkTools", "Example", "Libdl", "Logging", "Random", "StaticArrays", "Test"]
5 changes: 5 additions & 0 deletions src/abstractinterpret/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ let # overload `const_prop_call`
# successful constant prop', we need to update reports
collect_callee_reports!(analyzer, sv)
end
@static if VERSION ≥ v"1.11.0-DEV.233" || v"1.11.0-DEV" > VERSION ≥ v"1.10.0-beta1.11"
if concrete_eval_result !== nothing
filter_lineages!(analyzer, sv.result, mi)
end
end
return const_result
end
end
Expand Down
18 changes: 11 additions & 7 deletions test/analyzers/test_optanalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,13 @@ let result = @report_opt issue335_callf(issue335_problematic_callee, 42)
end
end

let result = report_opt() do
issue335_callf(42) do val
if val < 0
return issue335_problematic_callee(val)
end
return sin(val)
test_opt() do
issue335_callf(42) do val
if val < 0
return issue335_problematic_callee(val)
end
return sin(val)
end
@test isempty(get_reports_with_test(result))
end

# report runtime dispatches within "noncompileable" but inlineable frames
Expand All @@ -325,4 +323,10 @@ let result = report_opt((Any,Any)) do a, b
end
end

using StaticArrays
const Issue560Vec3 = SVector{3, Float64}
const issue560μ = zeros(Issue560Vec3, 2, 3, 4, 5)
issue560f(μ) = reinterpret(reshape, Float64, μ)
@test_opt issue560f(issue560μ)

end # module test_optanalyzer
Loading