[llvm-branch-commits] [llvm] RuntimeLibcalls: Use array initializers for default values (PR #143082)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jun 5 23:49:33 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/143082.diff
2 Files Affected:
- (modified) llvm/include/llvm/IR/RuntimeLibcalls.h (+5-3)
- (modified) llvm/lib/IR/RuntimeLibcalls.cpp (-10)
``````````diff
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index d2704d5aa2616..d67430968edf1 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -90,10 +90,11 @@ struct RuntimeLibcallsInfo {
private:
/// Stores the name each libcall.
- const char *LibcallRoutineNames[RTLIB::UNKNOWN_LIBCALL + 1];
+ const char *LibcallRoutineNames[RTLIB::UNKNOWN_LIBCALL + 1] = {nullptr};
/// Stores the CallingConv that should be used for each libcall.
- CallingConv::ID LibcallCallingConvs[RTLIB::UNKNOWN_LIBCALL];
+ CallingConv::ID LibcallCallingConvs[RTLIB::UNKNOWN_LIBCALL] = {
+ CallingConv::C};
/// The condition type that should be used to test the result of each of the
/// soft floating-point comparison libcall against integer zero.
@@ -101,7 +102,8 @@ struct RuntimeLibcallsInfo {
// FIXME: This is only relevant for the handful of floating-point comparison
// runtime calls; it's excessive to have a table entry for every single
// opcode.
- CmpInst::Predicate SoftFloatCompareLibcallPredicates[RTLIB::UNKNOWN_LIBCALL];
+ CmpInst::Predicate SoftFloatCompareLibcallPredicates[RTLIB::UNKNOWN_LIBCALL] =
+ {CmpInst::BAD_ICMP_PREDICATE};
static bool darwinHasSinCosStret(const Triple &TT) {
assert(TT.isOSDarwin() && "should be called with darwin triple");
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index a6fda0cfeadd2..01978b7ae39e3 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -12,9 +12,6 @@ using namespace llvm;
using namespace RTLIB;
void RuntimeLibcallsInfo::initSoftFloatCmpLibcallPredicates() {
- std::fill(SoftFloatCompareLibcallPredicates,
- SoftFloatCompareLibcallPredicates + RTLIB::UNKNOWN_LIBCALL,
- CmpInst::BAD_ICMP_PREDICATE);
SoftFloatCompareLibcallPredicates[RTLIB::OEQ_F32] = CmpInst::ICMP_EQ;
SoftFloatCompareLibcallPredicates[RTLIB::OEQ_F64] = CmpInst::ICMP_EQ;
SoftFloatCompareLibcallPredicates[RTLIB::OEQ_F128] = CmpInst::ICMP_EQ;
@@ -48,19 +45,12 @@ void RuntimeLibcallsInfo::initSoftFloatCmpLibcallPredicates() {
/// Set default libcall names. If a target wants to opt-out of a libcall it
/// should be placed here.
void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
- std::fill(std::begin(LibcallRoutineNames), std::end(LibcallRoutineNames),
- nullptr);
-
initSoftFloatCmpLibcallPredicates();
#define HANDLE_LIBCALL(code, name) setLibcallName(RTLIB::code, name);
#include "llvm/IR/RuntimeLibcalls.def"
#undef HANDLE_LIBCALL
- // Initialize calling conventions to their default.
- for (int LC = 0; LC < RTLIB::UNKNOWN_LIBCALL; ++LC)
- setLibcallCallingConv((RTLIB::Libcall)LC, CallingConv::C);
-
// Use the f128 variants of math functions on x86
if (TT.isX86() && TT.isGNUEnvironment()) {
setLibcallName(RTLIB::REM_F128, "fmodf128");
``````````
</details>
https://github.com/llvm/llvm-project/pull/143082
More information about the llvm-branch-commits
mailing list