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

functional() throws error for a break statement #129

Open
PoorvaGarg opened this issue Oct 4, 2024 · 0 comments · May be fixed by #130
Open

functional() throws error for a break statement #129

PoorvaGarg opened this issue Oct 4, 2024 · 0 comments · May be fixed by #130

Comments

@PoorvaGarg
Copy link

Using functional() on a function that consist of a loop and a break statement throws a KeyError. I have included a minimal example below. I am using Julia version 1.10.5. This bug further causes issues in using Julia library functions like reduce as they use functions within Julia that have a loop with a break statement.

julia> using IRTools: @code_ir, functional

julia> function f()
           while true break end
       end
f (generic function with 1 method)

julia> functional(@code_ir f())
ERROR: KeyError: key 2 not found
Stacktrace:
 [1] getindex(h::Dict{Any, Any}, key::Int64)
   @ Base ./dict.jl:498
 [2] functionalbranches!(bl::Any, pr::Any, labels::Any)
   @ IRTools.Inner ~/Desktop/IRTools.jl/src/passes/cps.jl:31
 [3] _functional(ir::Any, tree::Any, vars::Any, cs::Any)
   @ IRTools.Inner ~/Desktop/IRTools.jl/src/passes/cps.jl:66
 [4] _functional
   @ ~/Desktop/IRTools.jl/src/passes/cps.jl:50 [inlined]
 [5] _functional(ir::Any, tree::Any, vars::Any, cs::Any)
   @ IRTools.Inner ~/Desktop/IRTools.jl/src/passes/cps.jl:62
 [6] _functional
   @ ~/Desktop/IRTools.jl/src/passes/cps.jl:50 [inlined]
 [7] functional(ir::Any)
   @ IRTools.Inner ~/Desktop/IRTools.jl/src/passes/cps.jl:70
 [8] top-level scope
   @ REPL[3]:1
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

Successfully merging a pull request may close this issue.

1 participant