[llvm][Linker] llvm-link / ModuleLinker drops GlobalIFuncs

It appears that the code in llvm/lib/Linker/LinkModules.cpp doesn't
take GlobalIFunc-s into account, and therefore drops them. There are
three loops that iterate over GlobalVariable, Function and GlobalAlias
respectively, to collect them into ValuesToLink. I'm wondering whether
replacing these three loops with a single loop over all GlobalValues
is sufficient to remedy this.
WDYT?

It appears that the code in llvm/lib/Linker/LinkModules.cpp doesn't
take GlobalIFunc-s into account, and therefore drops them. There are
three loops that iterate over GlobalVariable, Function and GlobalAlias
respectively, to collect them into ValuesToLink. I'm wondering whether
replacing these three loops with a single loop over all GlobalValues
is sufficient to remedy this.
WDYT?

Looks good.

% cat a.ll
@foo = dso_local ifunc i32 (...), bitcast (i8* ()* @foo_resolver to i32 (...)*)

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i32 @foo_impl() #0 {
entry:
  ret i32 42
}

; Function Attrs: noinline nounwind optnone uwtable
define dso_local i8* @foo_resolver() #0 {
entry:
  ret i8* bitcast (i32 ()* @foo_impl to i8*)
}

attributes #0 = { "frame-pointer"="all" }
% llvm-link a.ll -S -o b.ll

The ifunc is incorrectly dropped.