Multiversioning does not rewrite instruction uses on the first target #50212
Labels
compiler:codegen
Generation of LLVM IR and native code
kind:bug
Indicates an unexpected problem or unintended behavior
pkgimage
status:won't change
Indicates that work won't continue on an issue or pull request
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 theclone_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 markedclone_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
The text was updated successfully, but these errors were encountered: