Skip to content

Commit 8aa7850

Browse files
committed
RuntimeLibcalls: Use array initializers for default values
1 parent ee79ca1 commit 8aa7850

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

llvm/include/llvm/IR/RuntimeLibcalls.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,20 @@ struct RuntimeLibcallsInfo {
9090

9191
private:
9292
/// Stores the name each libcall.
93-
const char *LibcallRoutineNames[RTLIB::UNKNOWN_LIBCALL + 1];
93+
const char *LibcallRoutineNames[RTLIB::UNKNOWN_LIBCALL + 1] = {nullptr};
9494

9595
/// Stores the CallingConv that should be used for each libcall.
96-
CallingConv::ID LibcallCallingConvs[RTLIB::UNKNOWN_LIBCALL];
96+
CallingConv::ID LibcallCallingConvs[RTLIB::UNKNOWN_LIBCALL] = {
97+
CallingConv::C};
9798

9899
/// The condition type that should be used to test the result of each of the
99100
/// soft floating-point comparison libcall against integer zero.
100101
///
101102
// FIXME: This is only relevant for the handful of floating-point comparison
102103
// runtime calls; it's excessive to have a table entry for every single
103104
// opcode.
104-
CmpInst::Predicate SoftFloatCompareLibcallPredicates[RTLIB::UNKNOWN_LIBCALL];
105+
CmpInst::Predicate SoftFloatCompareLibcallPredicates[RTLIB::UNKNOWN_LIBCALL] =
106+
{CmpInst::BAD_ICMP_PREDICATE};
105107

106108
static bool darwinHasSinCosStret(const Triple &TT) {
107109
assert(TT.isOSDarwin() && "should be called with darwin triple");

llvm/lib/IR/RuntimeLibcalls.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ using namespace llvm;
1212
using namespace RTLIB;
1313

1414
void RuntimeLibcallsInfo::initSoftFloatCmpLibcallPredicates() {
15-
std::fill(SoftFloatCompareLibcallPredicates,
16-
SoftFloatCompareLibcallPredicates + RTLIB::UNKNOWN_LIBCALL,
17-
CmpInst::BAD_ICMP_PREDICATE);
1815
SoftFloatCompareLibcallPredicates[RTLIB::OEQ_F32] = CmpInst::ICMP_EQ;
1916
SoftFloatCompareLibcallPredicates[RTLIB::OEQ_F64] = CmpInst::ICMP_EQ;
2017
SoftFloatCompareLibcallPredicates[RTLIB::OEQ_F128] = CmpInst::ICMP_EQ;
@@ -48,19 +45,12 @@ void RuntimeLibcallsInfo::initSoftFloatCmpLibcallPredicates() {
4845
/// Set default libcall names. If a target wants to opt-out of a libcall it
4946
/// should be placed here.
5047
void RuntimeLibcallsInfo::initLibcalls(const Triple &TT) {
51-
std::fill(std::begin(LibcallRoutineNames), std::end(LibcallRoutineNames),
52-
nullptr);
53-
5448
initSoftFloatCmpLibcallPredicates();
5549

5650
#define HANDLE_LIBCALL(code, name) setLibcallName(RTLIB::code, name);
5751
#include "llvm/IR/RuntimeLibcalls.def"
5852
#undef HANDLE_LIBCALL
5953

60-
// Initialize calling conventions to their default.
61-
for (int LC = 0; LC < RTLIB::UNKNOWN_LIBCALL; ++LC)
62-
setLibcallCallingConv((RTLIB::Libcall)LC, CallingConv::C);
63-
6454
// Use the f128 variants of math functions on x86
6555
if (TT.isX86() && TT.isGNUEnvironment()) {
6656
setLibcallName(RTLIB::REM_F128, "fmodf128");

0 commit comments

Comments
 (0)