While both GlobalAlias and GlobalIFunc are GlobalIndirectSymbol, their
getIndirectSymbol() usage is quite different (GlobalIFunc's resolver
is an entity different from GlobalIFunc itself).
As discussed on https://lists.llvm.org/pipermail/llvm-dev/2020-September/144904.html
("[IR] Modelling of GlobalIFunc"), the name getBaseObject is confusing when
used with GlobalIFunc.
To resolve the confusion:
- Move GloalIndirectSymol::getBaseObject to GlobalAlias:: (GlobalIFunc should use getResolver instead)
- Change GlobalValue::getBaseObject not to inspect GlobalIFunc. Note: the function has 7 references.
- Add GlobalIFunc::getResolverFunction to peel off potential ConstantExpr indirection (strlen in test/LTO/Resolution/X86/ifunc.ll)
Note: GlobalIFunc::getResolver (like GlobalAlias::getAliasee which does not peel
off ConstantExpr indirection) is kept to be used by ValueEnumerator.
When creating my own commit, I noticed that the two overloads below (with DataLayout and APInt) are completely unused. Perhaps we can use this opportunity to remove them?