[llvm] [APInt] remove getClearedMemory and improve slow initialization (PR #106945)

Princeton Ferro via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 00:59:32 PDT 2024


================
@@ -2105,7 +2100,7 @@ void APInt::fromString(unsigned numbits, StringRef str, uint8_t radix) {
   if (isSingleWord())
     U.VAL = 0;
   else
-    U.pVal = getClearedMemory(getNumWords());
+    U.pVal = new WordType[getNumWords()]();
----------------
Prince781 wrote:

`new T[]()` (as opposed to `new T[]`) will default-initialize to zero?

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


More information about the llvm-commits mailing list