Skip to content

Commit 67d0403

Browse files
committed
RuntimeLibcalls: Use array initializers for default values
1 parent 6e17ae5 commit 67d0403

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
@@ -103,18 +103,20 @@ struct RuntimeLibcallsInfo {
103103

104104
private:
105105
/// Stores the name each libcall.
106-
const char *LibcallRoutineNames[RTLIB::UNKNOWN_LIBCALL + 1];
106+
const char *LibcallRoutineNames[RTLIB::UNKNOWN_LIBCALL + 1] = {nullptr};
107107

108108
/// Stores the CallingConv that should be used for each libcall.
109-
CallingConv::ID LibcallCallingConvs[RTLIB::UNKNOWN_LIBCALL];
109+
CallingConv::ID LibcallCallingConvs[RTLIB::UNKNOWN_LIBCALL] = {
110+
CallingConv::C};
110111

111112
/// The condition type that should be used to test the result of each of the
112113
/// soft floating-point comparison libcall against integer zero.
113114
///
114115
// FIXME: This is only relevant for the handful of floating-point comparison
115116
// runtime calls; it's excessive to have a table entry for every single
116117
// opcode.
117-
CmpInst::Predicate SoftFloatCompareLibcallPredicates[RTLIB::UNKNOWN_LIBCALL];
118+
CmpInst::Predicate SoftFloatCompareLibcallPredicates[RTLIB::UNKNOWN_LIBCALL] =
119+
{CmpInst::BAD_ICMP_PREDICATE};
118120

119121
static bool darwinHasSinCosStret(const Triple &TT) {
120122
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)