[llvm] Allow optimization of __size_returning_new variants. (PR #102258)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 15:06:35 PDT 2024


================
@@ -1963,6 +1964,61 @@ Value *llvm::emitCalloc(Value *Num, Value *Size, IRBuilderBase &B,
   return CI;
 }
 
+Value *llvm::emitHotColdSizeReturningNew(Value *Num, IRBuilderBase &B,
+                                         const TargetLibraryInfo *TLI,
+                                         LibFunc SizeFeedbackNewFunc,
+                                         uint8_t HotCold) {
+  Module *M = B.GetInsertBlock()->getModule();
+  if (!isLibFuncEmittable(M, TLI, SizeFeedbackNewFunc))
+    return nullptr;
+
+  StringRef Name = TLI->getName(SizeFeedbackNewFunc);
+
+  // __sized_ptr_t struct return type { void*, size_t }
+  llvm::StructType *SizedPtrT =
----------------
snehasish wrote:

Done.

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


More information about the llvm-commits mailing list