Skip to content

Commit 08cd796

Browse files
committed
Fix loopinfo expression
1 parent c4237db commit 08cd796

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/copyable_task.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ function derive_copyable_task_ir(ir::BBCode)::Tuple{BBCode,Tuple,Vector{Any}}
704704
push!(inst_pairs, (ID(), new_inst(set_expr)))
705705
elseif stmt isa IDPhiNode
706706
# do nothing -- we've already handled any `PhiNode`s.
707+
elseif Meta.isexpr(stmt, :loopinfo)
708+
push!(inst_pairs, (id, inst))
707709
else
708710
throw(error("Unhandled stmt $stmt of type $(typeof(stmt))"))
709711
end

src/test_utils.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ function test_cases()
202202
[1, 2],
203203
allocs,
204204
),
205+
Testcase(
206+
"rosenbrock",
207+
nothing,
208+
(rosenbrock, rand(100_000), nothing),
209+
nothing,
210+
[],
211+
none,
212+
),
205213
]
206214
end
207215

@@ -354,4 +362,13 @@ function final_statement_produce()
354362
return produce(2)
355363
end
356364

365+
# Produces a `:loopinfo` expression.
366+
function rosenbrock(x, callback=nothing)
367+
i = x[2:end]
368+
j = x[1:(end - 1)]
369+
ret = sum((1 .- j) .^ 2 + 100 * (i - j .^ 2) .^ 2)
370+
callback !== nothing && callback(ret)
371+
return ret
372+
end
373+
357374
end

0 commit comments

Comments
 (0)