I am trying to track down some performance issues by tracing through the output of code_llvm
. Whenever the LLVM code contains a call to a Julia function, I would like to figure out which MethodInstance
of that function is getting called, and then recursively analyze the output of code_llvm
for that MethodInstance
. However, I am unable to determine the MethodInstance
in cases where different modules have functions with the same name, and my current strategy is unreliable for functions with multiple methods.
Here are some examples of relevant LLVM code:
call double @"j_^_18287"(double %0, i64 signext %10)
call i64 @j_mapreduce_impl_18993({}* nonnull %0, i64 signext 1, i64 signext %arraylen, i64 signext 1024)
call i64 @julia_mapreduce_impl_19022({}* %0, i64 signext %1, i64 signext %34, i64 signext %3)
call nonnull {}* @j1_print_to_string_14966({}* inttoptr (i64 5467587216 to {}*), {}** nonnull %.sub, i32 4)
Through some exploration, I’ve found that the LLVM name of a Julia function starts with @julia_
when the function is called recursively, @"j_
when the function name has non-standard characters, and @j_
or @j1_
otherwise. I have not been able to figure out what the string of numbers at the end of each function name corresponds to, though.
Does anyone know what this string of numbers is? Is it a unique identifier for each compiled MethodInstance
, and can I obtain this identifier without delving into the underlying C++ code? If not, is there some other information in the code_llvm
output that I could use to infer which MethodInstance
of a function is getting called?