[lld] [llvm] [LLVM][LTO] Factor out RTLib calls and allow them to be dropped (PR #98512)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 11:10:27 PDT 2024


================
@@ -1357,14 +1359,13 @@ Error LTO::runRegularLTO(AddStreamFn AddStream) {
   return finalizeOptimizationRemarks(std::move(DiagnosticOutputFile));
 }
 
-static const char *libcallRoutineNames[] = {
-#define HANDLE_LIBCALL(code, name) name,
-#include "llvm/IR/RuntimeLibcalls.def"
-#undef HANDLE_LIBCALL
-};
+SmallVector<const char *> LTO::getRuntimeLibcallSymbols(const Triple &TT) {
+  LibcallsInfo Libcalls(TT);
 
-ArrayRef<const char*> LTO::getRuntimeLibcallSymbols() {
-  return ArrayRef(libcallRoutineNames);
+  SmallVector<const char *> LibcallSymbols;
+  copy_if(Libcalls.getLibcallNames(), std::back_inserter(LibcallSymbols),
+          [](const char *Name) { return Name; });
+  return LibcallSymbols;
----------------
jhuber6 wrote:

I thought about that, but in-use this is only ever called once and never re-used. The alternative would need some dense map of triples to vectors and I don't think it would add anything.

https://github.com/llvm/llvm-project/pull/98512


More information about the llvm-commits mailing list