Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeInnes committed Aug 15, 2018
1 parent c792ef9 commit e056300
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/compiler/reverse.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
using Base: RefValue

accum!(r::RefValue, x) = (r.x = accum(r.x, deref(x)))

function accumif!(c::Bool, r::RefValue, x)
c && accum!(r, x)
return
end

deref!(x) = x

function deref!(r::RefValue)
y = r.x
r.x = nothing
return y
end

accum!(r::RefValue, x) = (r.x = accum(r.x, deref!(x)))

function accumif!(c::Bool, r::RefValue, x)
c && accum!(r, x)
return
end

iscall(x, m::Module, n::Symbol) = isexpr(x, :call) && x.args[1] == GlobalRef(m, n)

function merge_returns(ir)
Expand Down
2 changes: 2 additions & 0 deletions src/tools/slots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ struct Slot
id::Symbol
end

Base.show(io::IO, s::Slot) = print(io, s.id)

function insert_blockend!(ir::IRCode, pos, typ, val)
i = first(ir.cfg.blocks[pos].stmts)
j = last(ir.cfg.blocks[pos].stmts)
Expand Down

0 comments on commit e056300

Please sign in to comment.