Skip to content

Commit 46d3333

Browse files
authored
Remove gratuitous overloads. (#461)
* Remove gratuitous overloads. * Bump version
1 parent d57642c commit 46d3333

File tree

4 files changed

+19
-29
lines changed

4 files changed

+19
-29
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LoopVectorization"
22
uuid = "bdcacae8-1622-11e9-2a5c-532679323890"
33
authors = ["Chris Elrod <[email protected]>"]
4-
version = "0.12.146"
4+
version = "0.12.147"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/constructors.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# ls
1111
# end
1212

13-
function Base.copyto!(ls::LoopSet, q::Expr)
13+
function _copyto!(ls::LoopSet, q::Expr)
1414
q.head === :for || throw("Expression must be a for loop.")
1515
add_loop!(ls, q, 8)
1616
# strip_unneeded_const_deps!(ls)
@@ -108,7 +108,7 @@ function LoopSet(q::Expr, mod::Symbol = :Main)
108108
ls = LoopSet(mod)
109109
check_inputs!(q, ls.prepreamble)
110110
contract_pass!(q)
111-
copyto!(ls, q)
111+
_copyto!(ls, q)
112112
resize!(ls.loop_order, num_loops(ls))
113113
ls
114114
end

src/modeling/graphs.jl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pushexpr!(ex::Expr, x::Integer) =
7676
pushexpr!(ex::Expr, @nospecialize(x::StaticInt)) = (push!(ex.args, x); nothing)
7777
MaybeKnown(x::Integer) =
7878
MaybeKnown(convert(Int, x), Symbol("##UNDEFINED##"), true)
79-
MaybeKnown(x::Integer, default::Int) = MaybeKnown(x)
79+
MaybeKnown(x::Integer, ::Int) = MaybeKnown(x)
8080
MaybeKnown(x::Symbol, default::Int) = MaybeKnown(default, x, false)
8181

8282
isknown(mk::MaybeKnown) = getfield(mk, :known)
@@ -158,7 +158,7 @@ function arithmeticexpr(
158158
return _arithmeticexpr(f, a, b)
159159
end
160160
end
161-
arithmeticexpr(op, f, a, b) = _arithmeticexpr(f, a, b)
161+
arithmeticexpr(_, f, a, b) = _arithmeticexpr(f, a, b)
162162
function _arithmeticexpr(f, a, b)
163163
ex = Expr(:call, lv(f))
164164
pushexpr!(ex, a)
@@ -664,7 +664,8 @@ This is used so that identical loops will create identical `_turbo_!` calls in t
664664
"""
665665
gensym!(ls::LoopSet, s) = Symbol("###$(s)###$(ls.symcounter += 1)###")
666666

667-
fill_children!(ls::LoopSet) = for op operations(ls)
667+
fill_children!(ls::LoopSet) =
668+
for op operations(ls)
668669
empty!(children(op))
669670
for opp parents(op)
670671
@assert children(opp) !== NOPARENTS
@@ -688,7 +689,7 @@ function rejectinterleave!(
688689
op.rejectinterleave = true
689690
else
690691
omop = ls.omop
691-
batchid, opind = omop.batchedcollectionmap[identifier(op)]
692+
batchid, _ = omop.batchedcollectionmap[identifier(op)]
692693
op.rejectinterleave =
693694
((batchid == 0) || (!isvectorized(op))) ||
694695
rejectinterleave(ls, op, vloop, omop.batchedcollections[batchid])
@@ -984,7 +985,7 @@ function add_block!(ls::LoopSet, ex::Expr, elementbytes::Int, position::Int)
984985
for x ex.args
985986
x isa Expr || continue # be that general?
986987
x.head === :inbounds && continue
987-
push!(ls, x, elementbytes, position)
988+
_push!(ls, x, elementbytes, position)
988989
end
989990
end
990991
function makestatic!(expr)
@@ -1006,7 +1007,7 @@ function makestatic!(expr)
10061007
expr
10071008
end
10081009
add_loop_bound!(
1009-
ls::LoopSet,
1010+
::LoopSet,
10101011
itersym::Symbol,
10111012
bound::Union{Integer,Symbol},
10121013
upper::Bool,
@@ -1096,7 +1097,7 @@ end
10961097
r::OptionallyStaticRange,
10971098
::StaticInt{S}
10981099
) where {S}
1099-
ifelse(ArrayInterface.gt(StaticInt{S}(), Zero()), r, _reverse(r))
1100+
S > 0 ? r : _reverse(r)
11001101
end
11011102
@inline canonicalize_range(r::OptionallyStaticRange, s::Integer) =
11021103
s > 0 ? r : _reverse(r)
@@ -1378,7 +1379,7 @@ function add_loop!(ls::LoopSet, q::Expr, elementbytes::Int)
13781379
if body.head === :block
13791380
add_block!(ls, body, elementbytes, position)
13801381
else
1381-
push!(ls, q, elementbytes, position)
1382+
_push!(ls, q, elementbytes, position)
13821383
end
13831384
end
13841385
function add_loop!(ls::LoopSet, loop::Loop, itersym::Symbol = loop.itersymbol)
@@ -1409,7 +1410,7 @@ function instruction!(ls::LoopSet, x::Expr)
14091410
pushprepreamble!(ls, Expr(:(=), instr, x))
14101411
Instruction(Symbol(""), instr)
14111412
end
1412-
instruction!(ls::LoopSet, x::Symbol) = instruction(x)
1413+
instruction!(::LoopSet, x::Symbol) = instruction(x)
14131414
function instruction!(ls::LoopSet, f::F) where {F<:Function}
14141415
get(FUNCTIONSYMBOLS, F) do
14151416
instr = gensym!(ls, "f")
@@ -1819,14 +1820,14 @@ function push_op!(
18191820
add_compute!(ls, LHS, :identity, [RHS], elementbytes)
18201821
end
18211822
else
1822-
push!(ls, localbody, elementbytes, position, mpref)
1823+
_push!(ls, localbody, elementbytes, position, mpref)
18231824
end
18241825
else
18251826
throw(LoopError("Don't know how to handle expression.", ex))
18261827
end
18271828
end
18281829

1829-
function Base.push!(
1830+
function _push!(
18301831
ls::LoopSet,
18311832
ex::Expr,
18321833
elementbytes::Int,

src/parse/add_compute.jl

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,8 @@ function search_tree(opv::Vector{Operation}, var::Symbol) # relies on cycles bei
116116
false
117117
end
118118

119-
search_tree_for_ref(
120-
ls::LoopSet,
121-
opv::Vector{Operation},
122-
::Nothing,
123-
var::Symbol
124-
) = var, false
119+
search_tree_for_ref(::LoopSet, ::Vector{Operation}, ::Nothing, var::Symbol) =
120+
var, false
125121
function search_tree_for_ref(
126122
ls::LoopSet,
127123
opv::Vector{Operation},
@@ -433,35 +429,29 @@ function find_inner_reduct_parent(op::Operation, opname::Symbol)
433429
end
434430

435431
function maybe_fix_reduced_deps!(
436-
ls::LoopSet,
432+
::LoopSet,
437433
deps::Vector{Symbol},
438434
reduceddeps::Vector{Symbol},
439435
parent::Operation,
440436
mpref::ArrayReferenceMetaPosition,
441-
position::Int
437+
::Int
442438
)
443439
loopdeps_parent = loopdependencies(parent)
444440
reduceddeps_parent = reduceddependencies(parent)
445441
loopdeps_mpref = loopdependencies(mpref)
446442
loopdeps_new = Symbol[]
447-
# pushv = Vector{Symbol}[loopdeps_new, reduceddeps_parent]
448-
instr = instruction(parent).instr
449443
pparent_id = findfirst(Base.Fix2(===, name(parent)) name, parents(parent))
450444
pparent_id === nothing && return deps, reduceddeps
451445
pparent = parents(parent)[pparent_id]
452446
@assert length(loopdependencies(pparent)) ==
453447
length(loopdeps_parent) + length(reduceddeps_parent)
454448
reduceddeps_pparent = reduceddependencies(pparent)
455-
# if instr === :identity
456-
# push!(pushv,
457-
# if Base.sym_in(instr, :ident
458449
for ld loopdeps_parent
459450
if ld loopdeps_mpref
460451
push!(loopdeps_new, ld)
461452
else
462453
push!(reduceddeps_parent, ld)
463454
push!(reduceddeps_pparent, ld)
464-
# foreach(Base.Fix2(push!, ld), pushv)
465455
end
466456
end
467457
parent.dependencies = loopdeps_new
@@ -803,7 +793,6 @@ function add_pow!(
803793
elseif x isa Number
804794
return add_constant!(ls, x^p, elementbytes, var)::Operation
805795
end
806-
local pnum::Int, pden::Int
807796
if p isa Integer
808797
pnum = Int(p)::Int
809798
pden = 1

0 commit comments

Comments
 (0)