Skip to content

Commit 18f0cd4

Browse files
authored
Merge pull request #185 from DilumAluthge/dpa/avx-coverage
Try to fix a bug in code coverage
2 parents 591023e + a6f023f commit 18f0cd4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/condense_loopset.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,14 @@ function setup_call_debug(ls::LoopSet)
319319
pushpreamble!(ls, generate_call(ls, (zero(Int8),zero(Int8),zero(Int8)), true))
320320
Expr(:block, ls.prepreamble, ls.preamble)
321321
end
322-
function setup_call(ls::LoopSet, q = nothing, inline::Int8 = zero(Int8), check_empty::Bool = false, u₁::Int8 = zero(Int8), u₂::Int8 = zero(Int8))
322+
function setup_call(ls::LoopSet, q::Expr, source::LineNumberNode, inline::Int8 = zero(Int8), check_empty::Bool = false, u₁::Int8 = zero(Int8), u₂::Int8 = zero(Int8))
323323
# We outline/inline at the macro level by creating/not creating an anonymous function.
324324
# The old API instead was based on inlining or not inline the generated function, but
325325
# the generated function must be inlined into the initial loop preamble for performance reasons.
326326
# Creating an anonymous function and calling it also achieves the outlining, while still
327327
# inlining the generated function into the loop preamble.
328328
lnns = extract_all_lnns(q)
329+
pushfirst!(lnns, source)
329330
call = setup_call_inline(ls, inline, u₁, u₂)
330331
call = check_empty ? check_if_empty(ls, call) : call
331332
isnothing(q) && return Expr(:block, ls.prepreamble, call)

src/constructors.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ macro avx(q)
145145
q = macroexpand(__module__, q)
146146
isa(q, Expr) || return q
147147
q2 = if q.head === :for
148-
setup_call(LoopSet(q, __module__), q)
148+
setup_call(LoopSet(q, __module__), q, __source__)
149149
else# assume broadcast
150150
substitute_broadcast(q, Symbol(__module__))
151151
end
@@ -204,22 +204,22 @@ macro avx(arg, q)
204204
q = macroexpand(__module__, q)
205205
inline, check_empty, u₁, u₂ = check_macro_kwarg(arg)
206206
ls = LoopSet(q, __module__)
207-
esc(setup_call(ls, q, inline, check_empty, u₁, u₂))
207+
esc(setup_call(ls, q, __source__, inline, check_empty, u₁, u₂))
208208
end
209209
macro avx(arg1, arg2, q)
210210
@assert q.head === :for
211211
q = macroexpand(__module__, q)
212212
inline, check_empty, u₁, u₂ = check_macro_kwarg(arg1)
213213
inline, check_empty, u₁, u₂ = check_macro_kwarg(arg2, inline, check_empty, u₁, u₂)
214-
esc(setup_call(LoopSet(q, __module__), q, inline, check_empty, u₁, u₂))
214+
esc(setup_call(LoopSet(q, __module__), q, __source__, inline, check_empty, u₁, u₂))
215215
end
216216
macro avx(arg1, arg2, arg3, q)
217217
@assert q.head === :for
218218
q = macroexpand(__module__, q)
219219
inline, check_empty, u₁, u₂ = check_macro_kwarg(arg1)
220220
inline, check_empty, u₁, u₂ = check_macro_kwarg(arg2, inline, check_empty, u₁, u₂)
221221
inline, check_empty, u₁, u₂ = check_macro_kwarg(arg3, inline, check_empty, u₁, u₂)
222-
esc(setup_call(LoopSet(q, __module__), q, inline, check_empty, u₁, u₂))
222+
esc(setup_call(LoopSet(q, __module__), q, __source__, inline, check_empty, u₁, u₂))
223223
end
224224

225225

0 commit comments

Comments
 (0)