Skip to content

Commit

Permalink
ssair: another bug
Browse files Browse the repository at this point in the history
```
julia> iterate(t::Tuple, i=1) = (i > length(t) ? nothing : (t[i], i+1))
julia> function any_iterate(f, y)
           st = iterate(y)
           while !(st === nothing)
               f(st[1]) && return true
               st = iterate(y, st[2])
           end
           return false
       end
julia> code_typed(any_iterate, typeof((x -> :c == x, (:a, :b))))
```
  • Loading branch information
vtjnash committed Mar 30, 2018
1 parent f5cd2f5 commit bb1386a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions base/compiler/ssair/passes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,14 @@ function walk_to_def(compact, def, intermediaries = IdSet{Int}(), allow_phinode=
# For now, we don't track setfields structs through phi nodes
allow_phinode || break
push!(intermediaries, defidx)
possible_predecessors = collect(Iterators.filter(1:length(def.edges)) do n
isassigned(def.values, n) || return false
value = def.values[n]
edge_typ = compact_exprtype(compact, value)
return edge_typ typeconstraint
end)
possible_predecessors = let def=def, typeconstraint=typeconstraint
collect(Iterators.filter(1:length(def.edges)) do n
isassigned(def.values, n) || return false
value = def.values[n]
edge_typ = widenconst(compact_exprtype(compact, value))
return typeintersect(edge_typ, typeconstraint) !== Union{}
end)
end
# For now, only look at unique predecessors
if length(possible_predecessors) == 1
n = possible_predecessors[1]
Expand Down

0 comments on commit bb1386a

Please sign in to comment.