Skip to content

Commit

Permalink
OptAnalyzer: ignore reports from const-prop when concrete-evaled already
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Aug 22, 2023
1 parent 8986ed3 commit 2f50610
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
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

0 comments on commit 2f50610

Please sign in to comment.