You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using IRTools
using InteractiveUtils
f(x) = x + 1
@show IRTools.@code_ir f(1)
IRTools.@dynamo function test(a...)
ir = IRTools.IR(a...)
insert!(ir, IRTools.var(3), :(println("Hi!")))
return ir
end
@show IRTools.@code_ir test(f, 1)
@code_llvm test(f, 1)
test(f, 1)
The output:
#= /data/zhuoql/Work/julia/i.jl:7 =# IRTools.var"@code_ir"(f(1)) = 1: (%1, %2)
%3 = %2 + 1
return %3
#= /data/zhuoql/Work/julia/i.jl:15 =# IRTools.var"@code_ir"(test(f, 1)) = 1: (%1, %2)
%3 = Base.getfield(%2, 1)
%4 = Base.getfield(%2, 2)
%5 = println("Hi!")
%6 = %4 + 1
return %6
; @ /data/zhuoql/.julia/packages/IRTools/5JxlL/src/reflection/dynamo.jl:114 within `test'
; Function Attrs: noreturn
define void @julia_test_17807(i64) #0 {
top:
%1 = alloca %jl_value_t addrspace(10)*
%2 = getelementptr %jl_value_t addrspace(10)*, %jl_value_t addrspace(10)** %1, i32 0
store %jl_value_t addrspace(10)* addrspacecast (%jl_value_t* inttoptr (i64 140050782002832 to %jl_value_t*) to %jl_value_t addrspace(10)*), %jl_value_t addrspace(10)** %$
%3 = call nonnull %jl_value_t addrspace(10)* @jl_apply_generic(%jl_value_t addrspace(10)* addrspacecast (%jl_value_t* inttoptr (i64 140050873950960 to %jl_value_t*) to %$
l_value_t addrspace(10)*), %jl_value_t addrspace(10)** %1, i32 1)
call void @llvm.trap()
unreachable
}
Hi!
Unreachable reached at 0x7f6000b2ca2d
signal (4): Illegal instruction
in expression starting at /data/zhuoql/Work/julia/i.jl:20
test at /data/zhuoql/.julia/packages/IRTools/5JxlL/src/reflection/dynamo.jl:114
unknown function (ip: 0x7f6000b2ca43)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2141 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2305
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1631 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:328
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:417
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:368 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:778
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:888
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f5ffde48a0f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:897
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:814
jl_parse_eval_all at /buildworker/worker/package_linux64/build/src/ast.c:873
jl_load at /buildworker/worker/package_linux64/build/src/toplevel.c:878
include at ./boot.jl:328 [inlined]
include_relative at ./loading.jl:1105
include at ./Base.jl:31
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2135 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2305
exec_options at ./client.jl:287
_start at ./client.jl:460
jfptr__start_2084.clone_1 at /data/zhuoql/programs/julia-1.3.1/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2135 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2305
unknown function (ip: 0x401931)
unknown function (ip: 0x401533)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4015d4)
Allocations: 20385503 (Pool: 20383290; Big: 2213); GC: 23
Illegal instruction (core dumped)
The text was updated successfully, but these errors were encountered:
The problem is posted at https://discourse.julialang.org/t/got-unreachable-reached-error-while-using-irtools/44860, below is a minimal work example:
The output:
The text was updated successfully, but these errors were encountered: