[llvm-branch-commits] [llvm] RuntimeLibcalls: Use array initializers for default values (PR #143082)

Daniel Kiss via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jun 6 00:18:53 PDT 2025


================
@@ -90,18 +90,20 @@ 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.
   ///
   // 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};
----------------
DanielKristofKiss wrote:

CmpInst::BAD_ICMP_PREDICATE is not zero (42) so only the first element of the array will be initialized to `CmpInst::BAD_ICMP_PREDICATE` rest will be zero. 


https://github.com/llvm/llvm-project/pull/143082


More information about the llvm-branch-commits mailing list