Description
In the context of multiversioning, when a function for a clone_all
target calls a function that is cloned for a different target, we need to convert that direct call into a load from a global variable and an indirect call. This allows us to swap out which function we actually call based on the currently loaded target that we run on. However, on 1.9 and below we do not perform this direct->indirect call conversion when the clone_all
target is the first target at index 0. This means that we don't dispatch to the target-specific clones of functions unless they use a nonzero base target index, or if the target is marked clone_all
.
To observe the bug, simply output an LLVM bitcode file from the system image with an offending JULIA_CPU_TARGET string, disassemble it with llvm-dis
, grep for calls to functions with a .clone
suffix, and check for the existence of direct calls to the same function without a .clone
suffix. Such calls should not exist when multiversioning is working properly.
Note that this does not apply to master/1.10, as multiversioning has been significantly modified and does not have this issue anymore.
cc @vchuravy