aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2024-07-20 07:29:04 -0500
committerJoseph Huber <huberjn@outlook.com>2024-07-20 09:29:31 -0500
commit615b7eeaa94d7c2d2c782fcdc21de5b62f3c168e (patch)
tree8966b72fb6a46a69b9ca6cce2829ee203ec25fcf /llvm/lib/LTO/LTO.cpp
parent639560353408f82ca101e12cf4edafa9a492116b (diff)
downloadllvm-615b7eeaa94d7c2d2c782fcdc21de5b62f3c168e.zip
llvm-615b7eeaa94d7c2d2c782fcdc21de5b62f3c168e.tar.gz
llvm-615b7eeaa94d7c2d2c782fcdc21de5b62f3c168e.tar.bz2
Reapply "[LLVM][LTO] Factor out RTLib calls and allow them to be dropped (#98512)"
This reverts commit 740161a9b98c9920dedf1852b5f1c94d0a683af5. I moved the `ISD` dependencies into the CodeGen portion of the handling, it's a little awkward but it's the easiest solution I can think of for now.
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 94db666..bb3c9f7 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -30,6 +30,7 @@
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Mangler.h"
#include "llvm/IR/Metadata.h"
+#include "llvm/IR/RuntimeLibcalls.h"
#include "llvm/LTO/LTOBackend.h"
#include "llvm/LTO/SummaryBasedOptimizations.h"
#include "llvm/Linker/IRMover.h"
@@ -1357,14 +1358,12 @@ 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
-};
-
-ArrayRef<const char *> LTO::getRuntimeLibcallSymbols() {
- return ArrayRef(libcallRoutineNames);
+SmallVector<const char *> LTO::getRuntimeLibcallSymbols(const Triple &TT) {
+ RTLIB::RuntimeLibcallsInfo Libcalls(TT);
+ SmallVector<const char *> LibcallSymbols;
+ copy_if(Libcalls.getLibcallNames(), std::back_inserter(LibcallSymbols),
+ [](const char *Name) { return Name; });
+ return LibcallSymbols;
}
/// This class defines the interface to the ThinLTO backend.