Fix replace_local_module_scope_variables mempcy bug
replace_local_module_scope_variables was incorrectly trying to clone and
delete the original of memcpy which was referenced in a llvm.compiler.used
line to ensure it continued to exist.
This fixes this by looking at any globals and working back through the
user chain until we find an Instruction and only cloning functions that
actually require it, as well as all kernels. It also moves and modifies
the `addParamToAllFunctions` to the ReplaceLocalModuleScopeVariablesPass
as it is only used in there and we can make more appropriate changes.
This change puts it more in line with other similar add parameter
pass_functions such as the scheduling parameters and is more efficient.