================
@@ -279,9 +279,31 @@ static void runNewPMPasses(const Config &Conf, Module
&Mod, TargetMachine *TM,
RegisterPassPlugins(Conf.PassPlugins, PB);
std::unique_ptr<TargetLibraryInfoImpl> TLII(
- new TargetLibraryInfoImpl(TM->getTargetTriple(), TM->Options.VecLib));
+ new TargetLibraryInfoImpl(TM->getTargetTriple()));
if (Conf.Freestanding)
TLII->disableAllFunctions();
+
+ TargetLibraryInfo TLI(*TLII);
+ for (unsigned I = 0, E = static_cast<unsigned>(LibFunc::NumLibFuncs); I != E;
+ ++I) {
+ LibFunc F = static_cast<LibFunc>(I);
+ StringRef Name = TLI.getName(F);
+ GlobalValue *Val = Mod.getNamedValue(Name);
+
+ // LibFuncs present in the current TU can always be referenced.
+ if (Val && !Val->isDeclaration())
+ continue;
+
+ // LibFuncs not implemented in bitcode can always be referenced.
+ if (!BitcodeLibFuncs.contains(Name))
+ continue;
+
+ // FIXME: Functions that are somewhere in a ThinLTO link (just not imported
+ // in this module) should not be disabled, as they have already been
+ // extracted.
----------------
mysterymath wrote:
IIRC it's something that would have to be added; the symbol table seen by the
LTO backend has only symbols that directly concern a given TU; it doesn't have
a global view of the module. Another way I thought to might go about was
something like summarily including libcalls into the symbol table without
importing them. Still seems worth its own change either way.
https://github.com/llvm/llvm-project/pull/164916
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits