From b1a540ca57f4a8e08a6bb97cfdca4e3164e504df Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Mon, 2 Jun 2025 19:24:23 +0200 Subject: [PATCH] SystemZ: Move runtime libcall setting out of TargetLowering RuntimeLibcallInfo needs to be correct outside of codegen contexts. --- llvm/lib/IR/RuntimeLibcalls.cpp | 13 +++++++++++++ llvm/lib/{Target/SystemZ => IR}/ZOSLibcallNames.def | 0 llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 13 ------------- 3 files changed, 13 insertions(+), 13 deletions(-) rename llvm/lib/{Target/SystemZ => IR}/ZOSLibcallNames.def (100%) diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp index db0373055160c..d8451b818e8e3 100644 --- a/llvm/lib/IR/RuntimeLibcalls.cpp +++ b/llvm/lib/IR/RuntimeLibcalls.cpp @@ -278,4 +278,17 @@ void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) { } setLibcallName(RTLIB::MULO_I128, nullptr); } + + if (TT.isSystemZ() && TT.isOSzOS()) { + struct RTLibCallMapping { + RTLIB::Libcall Code; + const char *Name; + }; + static RTLibCallMapping RTLibCallCommon[] = { +#define HANDLE_LIBCALL(code, name) {RTLIB::code, name}, +#include "ZOSLibcallNames.def" + }; + for (auto &E : RTLibCallCommon) + setLibcallName(E.Code, E.Name); + } } diff --git a/llvm/lib/Target/SystemZ/ZOSLibcallNames.def b/llvm/lib/IR/ZOSLibcallNames.def similarity index 100% rename from llvm/lib/Target/SystemZ/ZOSLibcallNames.def rename to llvm/lib/IR/ZOSLibcallNames.def diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp index 3b86a9bc58790..f06246706aaa9 100644 --- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp @@ -828,19 +828,6 @@ SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &TM, // Default to having -disable-strictnode-mutation on IsStrictFPEnabled = true; - - if (Subtarget.isTargetzOS()) { - struct RTLibCallMapping { - RTLIB::Libcall Code; - const char *Name; - }; - static RTLibCallMapping RTLibCallCommon[] = { -#define HANDLE_LIBCALL(code, name) {RTLIB::code, name}, -#include "ZOSLibcallNames.def" - }; - for (auto &E : RTLibCallCommon) - setLibcallName(E.Code, E.Name); - } } bool SystemZTargetLowering::useSoftFloat() const {