@@ -92,7 +92,6 @@ function indices_calculated_by_pointer_offsets(ls::LoopSet, ar::ArrayReferenceMe
9292 ls. isbroadcast && return fill (false , length (indices))
9393 looporder = names (ls)
9494 offset = isdiscontiguous (ar)
95- gespinds = Expr (:tuple )
9695 out = Vector {Bool} (undef, length (indices))
9796 strds = getstrides (ar)
9897 li = ar. loopedindex
@@ -310,7 +309,7 @@ function isloopvalue(
310309 if (isrooted ≢ nothing )
311310 isrooted[i] || continue
312311 end
313- iscompute (op) || continue
312+ ( iscompute (op) | isstore (op) ) || continue
314313 for opp ∈ parents (op)# this is to confirm `ind` still has children
315314 # (isloopvalue(opp) && instruction(opp).instr === ind) && return true
316315 if (isloopvalue (opp) && instruction (opp). instr === ind)
@@ -331,10 +330,8 @@ function cse_constant_offsets!(
331330 # vptrar = vptr(ar)
332331 arrayref_to_name_op = arrayref_to_name_op_collection[allarrayrefsind]
333332 array_refs_with_same_name = name_to_array_map[first (first (arrayref_to_name_op))]
334- us = ls. unrollspecification
335333 li = ar. loopedindex
336334 indices = getindices (ar)
337- strides = getstrides (ar)
338335 offset = first (indices) === DISCONTIGUOUS
339336 # gespindoffsets = fill(Symbol(""), length(li))
340337 gespindsummary = Vector {Symbol} (undef, length (li))
@@ -814,7 +811,6 @@ function use_loop_induct_var!(
814811 q:: Expr ,
815812 ar:: ArrayReferenceMeta ,
816813 allarrayrefs:: Vector{ArrayReferenceMeta} ,
817- allarrayrefsind:: Int ,
818814 includeinlet:: Bool ,
819815 # array_refs_with_same_name::Vector{Int}, arrayref_to_name_op_collection::Vector{Vector{Tuple{Int,Int,Int}}}
820816):: Vector{Int}
@@ -868,7 +864,7 @@ function use_loop_induct_var!(
868864 Wisz || pushgespind! (gespinds, ls, Symbol (" " ), 0 , 1 , ind, isli, true , false )
869865 else
870866 uliv[i] = findfirst (Base. Fix2 (=== , ind), looporder):: Int
871- loop = getloop (ls, ind)
867+ # loop = getloop(ls, ind)
872868 push! (offsetprecalc_descript. args, max (5 , us. u₁ + 1 , us. u₂ + 1 ))
873869 use_offsetprecalc = true
874870 Wisz || pushgespind! (gespinds, ls, Symbol (" " ), 0 , 1 , ind, isli, false , false )
904900# Plan here is that we increment every unique array
905901function add_loop_start_stop_manager! (ls:: LoopSet )
906902 q = Expr (:block )
907- us = ls. unrollspecification
908903 # Presence of an explicit use of a loopinducation var means we should use that, so we look for one
909904 # TODO : replace first with only once you add Compat as a dep or drop support for older Julia versions
910905 loopinductvars = Symbol[]
@@ -917,7 +912,7 @@ function add_loop_start_stop_manager!(ls::LoopSet)
917912 use_livs = Vector {Vector{Int}} (undef, length (arrayrefs))
918913 # for i ∈ eachindex(name_to_array_map)
919914 for i ∈ eachindex (arrayrefs)
920- use_livs[i] = use_loop_induct_var! (ls, q, arrayrefs[i], arrayrefs, i, includeinlet[i])
915+ use_livs[i] = use_loop_induct_var! (ls, q, arrayrefs[i], arrayrefs, includeinlet[i])
921916 # name_to_array_map[first(first(unique_to_name_and_op_map[i]))], unique_to_name_and_op_map)
922917 end
923918 # loops, sorted from outer-most to inner-most
@@ -934,11 +929,9 @@ function add_loop_start_stop_manager!(ls::LoopSet)
934929 reached_indices = zeros (Int, length (arrayrefs))
935930 for (i, loopsym) ∈ enumerate (looporder) # iterates from outer to inner
936931 loopstartᵢ = ArrayReferenceMeta[]
937- arⱼ = 0
938- minrem = typemax (Int)
939932 ric = Tuple{Int,Int}[]
940933 for j ∈ eachindex (use_livs) # j is array ref number
941- for (l, k) ∈ enumerate ( use_livs[j]) # l is index number, k is loop number
934+ for k ∈ use_livs[j]# l is index number, k is loop number
942935 if k == i
943936 push! (loopstartᵢ, arrayrefs[j])
944937 push! (ric, ((reached_indices[j] += 1 ), length (loopstartᵢ)))
@@ -1006,7 +999,6 @@ function pointermax_index(
1006999 # @unpack u₁loopnum, u₂loopnum, vloopnum, u₁, u₂ = us
10071000 loopsym = names (ls)[n]
10081001 index = Expr (:tuple )
1009- found_loop_sym = false
10101002 ind = 0
10111003 for (j, i) ∈ enumerate (getindicesonly (ar))
10121004 if i === loopsym
@@ -1227,7 +1219,6 @@ function startloop(ls::LoopSet, us::UnrollSpecification, n::Int, staticinit::Boo
12271219 termind = lssm. terminators[n]
12281220 ptrdefs = lssm. incrementedptrs[n]
12291221 loopstart = Expr (:block )
1230- firstloop = n == num_loops (ls)
12311222 for ar ∈ ptrdefs
12321223 ptr_offset = vptr_offset (ar)
12331224 push! (loopstart. args, Expr (:(= ), ptr_offset, ptr_offset))
@@ -1288,7 +1279,7 @@ function incrementloopcounter!(
12881279 if iszero (termind) # increment liv
12891280 push! (q. args, incrementloopcounter (us, n, loopsym, UF, loop))
12901281 end
1291- for (j, ar) ∈ enumerate ( ptrdefs)
1282+ for ar ∈ ptrdefs
12921283 offsetinds = indices_calculated_by_pointer_offsets (ls, ar)
12931284 push! (q. args, offset_ptr (ar, us, loopsym, n, UF, offsetinds, loop))
12941285 end
0 commit comments