Skip to content

Commit

Permalink
type inference fix
Browse files Browse the repository at this point in the history
fixes #21
  • Loading branch information
MikeInnes committed Feb 4, 2020
1 parent e3fd59d commit 97a13bd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/ir/ir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ function setindex!(ir::IR, x, i::Variable)
b[i] = x
end

setindex!(b::Block, x, i::Variable) = setindex!(b.ir, x, i)

function Base.delete!(ir::IR, i::Variable)
ir[i] = nothing
ir.defs[i.id] = (-1, -1)
Expand Down
8 changes: 7 additions & 1 deletion src/reflection/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ function slots!(ir::IR)
for br in BasicBlock(b).branches
isreturn(br) && continue
for (i, val) in enumerate(br.args)
push!(b, :($(phislot(br.block, i)) = $val))
ϕ = phislot(br.block, i)
if val in keys(b) && !isexpr(b[val].expr, :(=))
b[val] = :($ϕ = $(b[val].expr))
slots[val] = ϕ
else
push!(b, :($ϕ = $val))
end
end
empty!(br.args)
end
Expand Down

0 comments on commit 97a13bd

Please sign in to comment.