When LLVM looks at the IR that Julia generates compiler (using code_llvm
) Some strange thing is that when using arrays in the signature of the function, give me an example as a logic:
Function test (A, B, C) does not return anything
(This is a worthless example, but the result is using code_llvm (test, (int, int, int))
, I get the following output:
:
; Function attrs: sspreq defined zero; julia_test14855 (i64, i64, i64) # 2 {top: retired zero, dbg 366!}
code_llvm (test, using array {int}, array {int}, array {int})
, get me unexpected results (at least for me) Is:
; Function Attrs:!% 3 = ICMP eq i32% 2, 3, dbg 369 br i1% 3, label% ifcont: sspreq% jl_value_t * @ julia_test14856 (% jl_value_t * ,% Jl_value_t **, i32) # 2 {defined top, label% other ,! DBG! 36 9 more:; ! Preds =% top call zero @jl_error (i8 * getelementptr in range ([26 x i8] * @ _j_str0, i64 0, i64 0)), dbg 369 out of reach, dbg 369 ifcont:; Preds =% top% 4 = load% jl_value_t ** inttoptr (i64 36,005,472% jl_value_t to **), 32 align! Dbg! 370 retired% jl_value_t *% 4 ,! Dbg! 370}
Why does the signature of the LLVM function not indexing only 3 variables as i64 *
or something like that? And why does not the function return zero
?
sign of LVM function only 3 variables I64 *
@ julia_test14856 (% jl_value_t *,% jl_value_t **, i32)
Logic:
- Pointer to stop function
- Points for boxed arguments (jl_value_t is the original box type)
- Number of arguments
The signature @ Warne Show is special calling conference Logic is still in boxed But logic types and countes are already known (and the function is off unnecessary because it is already specific).
About the output of your example function, this segment number of arguments (if not 3 -> goto label else:
):
Top:% 3 = ICMP EQ i32% 2, 3,! DBG! 36 9 BR i1% 3, label% ifcont, label% else ,! DBG! 36 9
This section returns the error:
else:; Preds =% top call zero @jl_error (i8 * getelementptr in range ([26 x i8] * @ _j_str0, i64 0, i64 0)),! Dbg! 369 Not accessible! Dbg! 369
Finally, the default case goes to this line which pulls the value for nothing
36005472
(@worne version In), this is a guarantee, so zero
directly).
% 4 = load% jl_value_t ** inttoptr (i64 36005472 to% jl_value_t **), align 32 ,! Dbg! 370
Comments
Post a Comment