Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWE: functional(ir) throws with Julia 1.4.1 (but works with 1.5-DEV) #55

Open
tkf opened this issue Apr 28, 2020 · 0 comments
Open

MWE: functional(ir) throws with Julia 1.4.1 (but works with 1.5-DEV) #55

tkf opened this issue Apr 28, 2020 · 0 comments

Comments

@tkf
Copy link

tkf commented Apr 28, 2020

using IRTools
using IRTools: @dynamo, IR, functional

@dynamo function cpsify(f, args...)
    ir = IR(f, args...)
    ir === nothing && return :(f(args...))
    return functional(ir)
end

return_false() = false

function demo(xs)
    for x in xs
        return_false() && return
    end
end

cpsify(demo, 1:1)

throws

ERROR: Error compiling @dynamo typeof(cpsify) on (typeof(demo), UnitRange{Int64}):
KeyError: key 2 not found
Stacktrace:
 [1] getindex at ./dict.jl:477 [inlined]
 [2] (::IRTools.Inner.var"#brfunc#198"{Dict{Any,Any}})(::IRTools.Inner.Branch) at /home/takafumi/.julia/dev/IRTools/src/passes/cps.jl:41
 [3] functionalbranches!(::IRTools.Inner.IR, ::IRTools.Inner.Pipe, ::Dict{Any,Any}) at /home/takafumi/.julia/dev/IRTools/src/passes/cps.jl:43
 [4] _functional(::IRTools.Inner.IR, ::Pair{Int64,Any}, ::Array{Any,1}, ::Dict{Any,Any}) at /home/takafumi/.julia/dev/IRTools/src/passes/cps.jl:66
 [5] _functional(::IRTools.Inner.IR, ::Pair{Int64,Any}, ::Array{Any,1}) at /home/takafumi/.julia/dev/IRTools/src/passes/cps.jl:50
 [6] _functional(::IRTools.Inner.IR, ::Pair{Int64,Any}, ::Array{Any,1}, ::Dict{Any,Any}) at /home/takafumi/.julia/dev/IRTools/src/passes/cps.jl:62
 [7] _functional(::IRTools.Inner.IR, ::Pair{Int64,Any}) at /home/takafumi/.julia/dev/IRTools/src/passes/cps.jl:50
 [8] functional(::IRTools.Inner.IR) at /home/takafumi/.julia/dev/IRTools/src/passes/cps.jl:70
 [9] macro expansion at ./REPL[3]:4 [inlined]
 [10] transform(::Type{typeof(cpsify)}, ::Type{T} where T, ::Type{T} where T) at /home/takafumi/.julia/dev/IRTools/src/reflection/dynamo.jl:122
 [11] dynamo(::Dict{Any,Any}, ::Type{T} where T, ::Type{T} where T, ::Vararg{Type{T} where T,N} where N) at /home/takafumi/.julia/dev/IRTools/src/reflection/dynamo.jl:62
 [12] #s15#9(::Any, ::Any) at /home/takafumi/.julia/dev/IRTools/src/reflection/dynamo.jl:114
 [13] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any,N} where N) at ./boot.jl:526
 [14] top-level scope at REPL[6]:1

in Julia 1.3.1 and 1.4.1 but not in 1.5.0-DEV.683.

I checked this with IRTools v0.3.2 6d227c0

@tkf tkf changed the title MEW: functional(ir) throws with Julia 1.4.1 (but works with 1.5-DEV) MWE: functional(ir) throws with Julia 1.4.1 (but works with 1.5-DEV) Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant