[llvm] 39f7b48 - [MemProf] Use updated version of hot/cold operator new

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 13:35:57 PDT 2023


Author: Teresa Johnson
Date: 2023-04-28T13:35:46-07:00
New Revision: 39f7b48671dae5fbe3afc49f33f50c2b6340bb89

URL: https://github.com/llvm/llvm-project/commit/39f7b48671dae5fbe3afc49f33f50c2b6340bb89
DIFF: https://github.com/llvm/llvm-project/commit/39f7b48671dae5fbe3afc49f33f50c2b6340bb89.diff

LOG: [MemProf] Use updated version of hot/cold operator new

Switch to the just updated versions of the API in tcmalloc that change
the name of the hot cold paramter to a reserved identifier __hot_cold_t.
This was based on feedback from Richard Smith, as I also need to add
some follow-on handling to clang so they are annotated properly.

Differential Revision: https://reviews.llvm.org/D149475

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/TargetLibraryInfo.def
    llvm/lib/Analysis/MemoryBuiltins.cpp
    llvm/lib/Analysis/TargetLibraryInfo.cpp
    llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
    llvm/test/Transforms/InstCombine/simplify-libcalls-new.ll
    llvm/test/tools/llvm-tli-checker/ps4-tli-check.yaml
    llvm/unittests/Analysis/TargetLibraryInfoTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
index 72a32a5b37d62..03ac422d3e6b7 100644
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
@@ -256,14 +256,14 @@ TLI_DEFINE_ENUM_INTERNAL(Znam)
 TLI_DEFINE_STRING_INTERNAL("_Znam")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long)
 
-/// void *operator new[](unsigned long, hot_cold_t)
-/// Currently this and other operator new interfaces that take a hot_cold_t
+/// void *operator new[](unsigned long, __hot_cold_t)
+/// Currently this and other operator new interfaces that take a __hot_cold_t
 /// hint are supported by the open source version of tcmalloc, see:
 /// https://github.com/google/tcmalloc/blob/master/tcmalloc/new_extension.h
-/// and for the definition of the hot_cold_t parameter see:
+/// and for the definition of the __hot_cold_t parameter see:
 /// https://github.com/google/tcmalloc/blob/master/tcmalloc/malloc_extension.h
-TLI_DEFINE_ENUM_INTERNAL(Znam10hot_cold_t)
-TLI_DEFINE_STRING_INTERNAL("_Znam10hot_cold_t")
+TLI_DEFINE_ENUM_INTERNAL(Znam12__hot_cold_t)
+TLI_DEFINE_STRING_INTERNAL("_Znam12__hot_cold_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Bool)
 
 /// void *operator new[](unsigned long, const std::nothrow_t&);
@@ -271,9 +271,9 @@ TLI_DEFINE_ENUM_INTERNAL(ZnamRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnamRKSt9nothrow_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Ptr)
 
-/// void *operator new[](unsigned long, const std::nothrow_t&, hot_cold_t)
-TLI_DEFINE_ENUM_INTERNAL(ZnamRKSt9nothrow_t10hot_cold_t)
-TLI_DEFINE_STRING_INTERNAL("_ZnamRKSt9nothrow_t10hot_cold_t")
+/// void *operator new[](unsigned long, const std::nothrow_t&, __hot_cold_t)
+TLI_DEFINE_ENUM_INTERNAL(ZnamRKSt9nothrow_t12__hot_cold_t)
+TLI_DEFINE_STRING_INTERNAL("_ZnamRKSt9nothrow_t12__hot_cold_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Ptr, Bool)
 
 /// void *operator new[](unsigned long, std::align_val_t)
@@ -281,9 +281,9 @@ TLI_DEFINE_ENUM_INTERNAL(ZnamSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnamSt11align_val_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long)
 
-/// void *operator new[](unsigned long, std::align_val_t, hot_cold_t)
-TLI_DEFINE_ENUM_INTERNAL(ZnamSt11align_val_t10hot_cold_t)
-TLI_DEFINE_STRING_INTERNAL("_ZnamSt11align_val_t10hot_cold_t")
+/// void *operator new[](unsigned long, std::align_val_t, __hot_cold_t)
+TLI_DEFINE_ENUM_INTERNAL(ZnamSt11align_val_t12__hot_cold_t)
+TLI_DEFINE_STRING_INTERNAL("_ZnamSt11align_val_t12__hot_cold_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long, Bool)
 
 /// void *operator new[](unsigned long, std::align_val_t, const std::nothrow_t&)
@@ -291,9 +291,9 @@ TLI_DEFINE_ENUM_INTERNAL(ZnamSt11align_val_tRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnamSt11align_val_tRKSt9nothrow_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long, Ptr)
 
-/// void *operator new[](unsigned long, std::align_val_t, const std::nothrow_t&, hot_cold_t)
-TLI_DEFINE_ENUM_INTERNAL(ZnamSt11align_val_tRKSt9nothrow_t10hot_cold_t)
-TLI_DEFINE_STRING_INTERNAL("_ZnamSt11align_val_tRKSt9nothrow_t10hot_cold_t")
+/// void *operator new[](unsigned long, std::align_val_t, const std::nothrow_t&, __hot_cold_t)
+TLI_DEFINE_ENUM_INTERNAL(ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t)
+TLI_DEFINE_STRING_INTERNAL("_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long, Ptr, Bool)
 
 /// void *operator new(unsigned int);
@@ -321,9 +321,9 @@ TLI_DEFINE_ENUM_INTERNAL(Znwm)
 TLI_DEFINE_STRING_INTERNAL("_Znwm")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long)
 
-/// void *operator new(unsigned long, hot_cold_t)
-TLI_DEFINE_ENUM_INTERNAL(Znwm10hot_cold_t)
-TLI_DEFINE_STRING_INTERNAL("_Znwm10hot_cold_t")
+/// void *operator new(unsigned long, __hot_cold_t)
+TLI_DEFINE_ENUM_INTERNAL(Znwm12__hot_cold_t)
+TLI_DEFINE_STRING_INTERNAL("_Znwm12__hot_cold_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Bool)
 
 /// void *operator new(unsigned long, const std::nothrow_t&);
@@ -331,9 +331,9 @@ TLI_DEFINE_ENUM_INTERNAL(ZnwmRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnwmRKSt9nothrow_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Ptr)
 
-/// void *operator new(unsigned long, const std::nothrow_t&, hot_cold_t)
-TLI_DEFINE_ENUM_INTERNAL(ZnwmRKSt9nothrow_t10hot_cold_t)
-TLI_DEFINE_STRING_INTERNAL("_ZnwmRKSt9nothrow_t10hot_cold_t")
+/// void *operator new(unsigned long, const std::nothrow_t&, __hot_cold_t)
+TLI_DEFINE_ENUM_INTERNAL(ZnwmRKSt9nothrow_t12__hot_cold_t)
+TLI_DEFINE_STRING_INTERNAL("_ZnwmRKSt9nothrow_t12__hot_cold_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Ptr, Bool)
 
 /// void *operator new(unsigned long, std::align_val_t)
@@ -341,9 +341,9 @@ TLI_DEFINE_ENUM_INTERNAL(ZnwmSt11align_val_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnwmSt11align_val_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long)
 
-/// void *operator new(unsigned long, std::align_val_t, hot_cold_t)
-TLI_DEFINE_ENUM_INTERNAL(ZnwmSt11align_val_t10hot_cold_t)
-TLI_DEFINE_STRING_INTERNAL("_ZnwmSt11align_val_t10hot_cold_t")
+/// void *operator new(unsigned long, std::align_val_t, __hot_cold_t)
+TLI_DEFINE_ENUM_INTERNAL(ZnwmSt11align_val_t12__hot_cold_t)
+TLI_DEFINE_STRING_INTERNAL("_ZnwmSt11align_val_t12__hot_cold_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long, Bool)
 
 /// void *operator new(unsigned long, std::align_val_t, const std::nothrow_t&)
@@ -351,9 +351,9 @@ TLI_DEFINE_ENUM_INTERNAL(ZnwmSt11align_val_tRKSt9nothrow_t)
 TLI_DEFINE_STRING_INTERNAL("_ZnwmSt11align_val_tRKSt9nothrow_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long, Ptr)
 
-/// void *operator new(unsigned long, std::align_val_t, const std::nothrow_t&, hot_cold_t)
-TLI_DEFINE_ENUM_INTERNAL(ZnwmSt11align_val_tRKSt9nothrow_t10hot_cold_t)
-TLI_DEFINE_STRING_INTERNAL("_ZnwmSt11align_val_tRKSt9nothrow_t10hot_cold_t")
+/// void *operator new(unsigned long, std::align_val_t, const std::nothrow_t&, __hot_cold_t)
+TLI_DEFINE_ENUM_INTERNAL(ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t)
+TLI_DEFINE_STRING_INTERNAL("_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t")
 TLI_DEFINE_SIG_INTERNAL(Ptr, Long, Long, Ptr, Bool)
 
 /// double __acos_finite(double x);

diff  --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index 116a9222a241a..9fabca2e04206 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -115,25 +115,25 @@ static const std::pair<LibFunc, AllocFnsTy> AllocationFnData[] = {
     {LibFunc_ZnwjSt11align_val_t,               {OpNewLike,        2,  0, -1,  1, MallocFamily::CPPNewAligned}},      // new(unsigned int, align_val_t)
     {LibFunc_ZnwjSt11align_val_tRKSt9nothrow_t, {MallocLike,       3,  0, -1,  1, MallocFamily::CPPNewAligned}},      // new(unsigned int, align_val_t, nothrow)
     {LibFunc_Znwm,                              {OpNewLike,        1,  0, -1, -1, MallocFamily::CPPNew}},             // new(unsigned long)
-    {LibFunc_Znwm10hot_cold_t,                  {OpNewLike,        2, 0,  -1, -1, MallocFamily::CPPNew}},             // new(unsigned long, hot_cold_t)
+    {LibFunc_Znwm12__hot_cold_t,                  {OpNewLike,        2, 0,  -1, -1, MallocFamily::CPPNew}},             // new(unsigned long, __hot_cold_t)
     {LibFunc_ZnwmRKSt9nothrow_t,                {MallocLike,       2,  0, -1, -1, MallocFamily::CPPNew}},             // new(unsigned long, nothrow)
-    {LibFunc_ZnwmRKSt9nothrow_t10hot_cold_t,      {MallocLike,       3, 0,  -1, -1, MallocFamily::CPPNew}},             // new(unsigned long, nothrow, hot_cold_t)
+    {LibFunc_ZnwmRKSt9nothrow_t12__hot_cold_t,      {MallocLike,       3, 0,  -1, -1, MallocFamily::CPPNew}},             // new(unsigned long, nothrow, __hot_cold_t)
     {LibFunc_ZnwmSt11align_val_t,               {OpNewLike,        2,  0, -1,  1, MallocFamily::CPPNewAligned}},      // new(unsigned long, align_val_t)
-    {LibFunc_ZnwmSt11align_val_t10hot_cold_t,   {OpNewLike,        3, 0,  -1, 1, MallocFamily::CPPNewAligned}},       // new(unsigned long, align_val_t, hot_cold_t)
+    {LibFunc_ZnwmSt11align_val_t12__hot_cold_t,   {OpNewLike,        3, 0,  -1, 1, MallocFamily::CPPNewAligned}},       // new(unsigned long, align_val_t, __hot_cold_t)
     {LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t, {MallocLike,       3,  0, -1,  1, MallocFamily::CPPNewAligned}},      // new(unsigned long, align_val_t, nothrow)
-    {LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t10hot_cold_t, {MallocLike,  4, 0,  -1, 1, MallocFamily::CPPNewAligned}},            // new(unsigned long, align_val_t, nothrow, hot_cold_t)
+    {LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t, {MallocLike,  4, 0,  -1, 1, MallocFamily::CPPNewAligned}},            // new(unsigned long, align_val_t, nothrow, __hot_cold_t)
     {LibFunc_Znaj,                              {OpNewLike,        1,  0, -1, -1, MallocFamily::CPPNewArray}},        // new[](unsigned int)
     {LibFunc_ZnajRKSt9nothrow_t,                {MallocLike,       2,  0, -1, -1, MallocFamily::CPPNewArray}},        // new[](unsigned int, nothrow)
     {LibFunc_ZnajSt11align_val_t,               {OpNewLike,        2,  0, -1,  1, MallocFamily::CPPNewArrayAligned}}, // new[](unsigned int, align_val_t)
     {LibFunc_ZnajSt11align_val_tRKSt9nothrow_t, {MallocLike,       3,  0, -1,  1, MallocFamily::CPPNewArrayAligned}}, // new[](unsigned int, align_val_t, nothrow)
     {LibFunc_Znam,                              {OpNewLike,        1,  0, -1, -1, MallocFamily::CPPNewArray}},        // new[](unsigned long)
-    {LibFunc_Znam10hot_cold_t,                  {OpNewLike,        2, 0,  -1, -1, MallocFamily::CPPNew}},             // new[](unsigned long, hot_cold_t)
+    {LibFunc_Znam12__hot_cold_t,                  {OpNewLike,        2, 0,  -1, -1, MallocFamily::CPPNew}},             // new[](unsigned long, __hot_cold_t)
     {LibFunc_ZnamRKSt9nothrow_t,                {MallocLike,       2,  0, -1, -1, MallocFamily::CPPNewArray}},        // new[](unsigned long, nothrow)
-    {LibFunc_ZnamRKSt9nothrow_t10hot_cold_t,      {MallocLike,       3, 0,  -1, -1, MallocFamily::CPPNew}},             // new[](unsigned long, nothrow, hot_cold_t)
+    {LibFunc_ZnamRKSt9nothrow_t12__hot_cold_t,      {MallocLike,       3, 0,  -1, -1, MallocFamily::CPPNew}},             // new[](unsigned long, nothrow, __hot_cold_t)
     {LibFunc_ZnamSt11align_val_t,               {OpNewLike,        2,  0, -1,  1, MallocFamily::CPPNewArrayAligned}}, // new[](unsigned long, align_val_t)
-    {LibFunc_ZnamSt11align_val_t10hot_cold_t,   {OpNewLike,        3, 0,  -1, 1, MallocFamily::CPPNewAligned}},       // new[](unsigned long, align_val_t, hot_cold_t)
+    {LibFunc_ZnamSt11align_val_t12__hot_cold_t,   {OpNewLike,        3, 0,  -1, 1, MallocFamily::CPPNewAligned}},       // new[](unsigned long, align_val_t, __hot_cold_t)
     {LibFunc_ZnamSt11align_val_tRKSt9nothrow_t, {MallocLike,       3,  0, -1,  1, MallocFamily::CPPNewArrayAligned}}, // new[](unsigned long, align_val_t, nothrow)
-    {LibFunc_ZnamSt11align_val_tRKSt9nothrow_t10hot_cold_t, {MallocLike,  4, 0,  -1, 1, MallocFamily::CPPNewAligned}},            // new[](unsigned long, align_val_t, nothrow, hot_cold_t)
+    {LibFunc_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t, {MallocLike,  4, 0,  -1, 1, MallocFamily::CPPNewAligned}},            // new[](unsigned long, align_val_t, nothrow, __hot_cold_t)
     {LibFunc_msvc_new_int,                      {OpNewLike,        1,  0, -1, -1, MallocFamily::MSVCNew}},            // new(unsigned int)
     {LibFunc_msvc_new_int_nothrow,              {MallocLike,       2,  0, -1, -1, MallocFamily::MSVCNew}},            // new(unsigned int, nothrow)
     {LibFunc_msvc_new_longlong,                 {OpNewLike,        1,  0, -1, -1, MallocFamily::MSVCNew}},            // new(unsigned long long)

diff  --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp
index 00ed1edd3a881..0376c011fb76a 100644
--- a/llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -474,7 +474,7 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
     TLI.setUnavailable(LibFunc_ZnajSt11align_val_tRKSt9nothrow_t);
     TLI.setUnavailable(LibFunc_Znam);
     TLI.setUnavailable(LibFunc_ZnamRKSt9nothrow_t);
-    TLI.setUnavailable(LibFunc_ZnamRKSt9nothrow_t10hot_cold_t);
+    TLI.setUnavailable(LibFunc_ZnamRKSt9nothrow_t12__hot_cold_t);
     TLI.setUnavailable(LibFunc_ZnamSt11align_val_t);
     TLI.setUnavailable(LibFunc_ZnamSt11align_val_tRKSt9nothrow_t);
     TLI.setUnavailable(LibFunc_Znwj);
@@ -483,15 +483,15 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
     TLI.setUnavailable(LibFunc_ZnwjSt11align_val_tRKSt9nothrow_t);
     TLI.setUnavailable(LibFunc_Znwm);
     TLI.setUnavailable(LibFunc_ZnwmRKSt9nothrow_t);
-    TLI.setUnavailable(LibFunc_ZnwmRKSt9nothrow_t10hot_cold_t);
+    TLI.setUnavailable(LibFunc_ZnwmRKSt9nothrow_t12__hot_cold_t);
     TLI.setUnavailable(LibFunc_ZnwmSt11align_val_t);
     TLI.setUnavailable(LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t);
-    TLI.setUnavailable(LibFunc_Znwm10hot_cold_t);
-    TLI.setUnavailable(LibFunc_ZnwmSt11align_val_t10hot_cold_t);
-    TLI.setUnavailable(LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t10hot_cold_t);
-    TLI.setUnavailable(LibFunc_Znam10hot_cold_t);
-    TLI.setUnavailable(LibFunc_ZnamSt11align_val_t10hot_cold_t);
-    TLI.setUnavailable(LibFunc_ZnamSt11align_val_tRKSt9nothrow_t10hot_cold_t);
+    TLI.setUnavailable(LibFunc_Znwm12__hot_cold_t);
+    TLI.setUnavailable(LibFunc_ZnwmSt11align_val_t12__hot_cold_t);
+    TLI.setUnavailable(LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t);
+    TLI.setUnavailable(LibFunc_Znam12__hot_cold_t);
+    TLI.setUnavailable(LibFunc_ZnamSt11align_val_t12__hot_cold_t);
+    TLI.setUnavailable(LibFunc_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t);
   } else {
     // Not MSVC, assume it's Itanium.
     TLI.setUnavailable(LibFunc_msvc_new_int);

diff  --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index d40eecaaf58f1..65be1243cadab 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -1661,7 +1661,7 @@ Value *LibCallSimplifier::optimizeRealloc(CallInst *CI, IRBuilderBase &B) {
 }
 
 // When enabled, replace operator new() calls marked with a hot or cold memprof
-// attribute with an operator new() call that takes a hot_cold_t parameter.
+// attribute with an operator new() call that takes a __hot_cold_t parameter.
 // Currently this is supported by the open source version of tcmalloc, see:
 // https://github.com/google/tcmalloc/blob/master/tcmalloc/new_extension.h
 Value *LibCallSimplifier::optimizeNew(CallInst *CI, IRBuilderBase &B,
@@ -1680,34 +1680,34 @@ Value *LibCallSimplifier::optimizeNew(CallInst *CI, IRBuilderBase &B,
   switch (Func) {
   case LibFunc_Znwm:
     return emitHotColdNew(CI->getArgOperand(0), B, TLI,
-                          LibFunc_Znwm10hot_cold_t, HotCold);
+                          LibFunc_Znwm12__hot_cold_t, HotCold);
   case LibFunc_Znam:
     return emitHotColdNew(CI->getArgOperand(0), B, TLI,
-                          LibFunc_Znam10hot_cold_t, HotCold);
+                          LibFunc_Znam12__hot_cold_t, HotCold);
   case LibFunc_ZnwmRKSt9nothrow_t:
     return emitHotColdNewNoThrow(CI->getArgOperand(0), CI->getArgOperand(1), B,
-                                 TLI, LibFunc_ZnwmRKSt9nothrow_t10hot_cold_t,
+                                 TLI, LibFunc_ZnwmRKSt9nothrow_t12__hot_cold_t,
                                  HotCold);
   case LibFunc_ZnamRKSt9nothrow_t:
     return emitHotColdNewNoThrow(CI->getArgOperand(0), CI->getArgOperand(1), B,
-                                 TLI, LibFunc_ZnamRKSt9nothrow_t10hot_cold_t,
+                                 TLI, LibFunc_ZnamRKSt9nothrow_t12__hot_cold_t,
                                  HotCold);
   case LibFunc_ZnwmSt11align_val_t:
     return emitHotColdNewAligned(CI->getArgOperand(0), CI->getArgOperand(1), B,
-                                 TLI, LibFunc_ZnwmSt11align_val_t10hot_cold_t,
+                                 TLI, LibFunc_ZnwmSt11align_val_t12__hot_cold_t,
                                  HotCold);
   case LibFunc_ZnamSt11align_val_t:
     return emitHotColdNewAligned(CI->getArgOperand(0), CI->getArgOperand(1), B,
-                                 TLI, LibFunc_ZnamSt11align_val_t10hot_cold_t,
+                                 TLI, LibFunc_ZnamSt11align_val_t12__hot_cold_t,
                                  HotCold);
   case LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t:
     return emitHotColdNewAlignedNoThrow(
         CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), B,
-        TLI, LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t10hot_cold_t, HotCold);
+        TLI, LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t, HotCold);
   case LibFunc_ZnamSt11align_val_tRKSt9nothrow_t:
     return emitHotColdNewAlignedNoThrow(
         CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), B,
-        TLI, LibFunc_ZnamSt11align_val_tRKSt9nothrow_t10hot_cold_t, HotCold);
+        TLI, LibFunc_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t, HotCold);
   default:
     return nullptr;
   }

diff  --git a/llvm/test/Transforms/InstCombine/simplify-libcalls-new.ll b/llvm/test/Transforms/InstCombine/simplify-libcalls-new.ll
index 47917fd5434e7..1601a086c8748 100644
--- a/llvm/test/Transforms/InstCombine/simplify-libcalls-new.ll
+++ b/llvm/test/Transforms/InstCombine/simplify-libcalls-new.ll
@@ -2,60 +2,60 @@
 ; RUN: opt < %s -passes=instcombine -optimize-hot-cold-new -S | FileCheck %s --check-prefix=HOTCOLD
 
 ;; Check that operator new(unsigned long) converted to
-;; operator new(unsigned long, hot_cold_t) with a hot or cold attribute.
+;; operator new(unsigned long, __hot_cold_t) with a hot or cold attribute.
 ; HOTCOLD-LABEL: @new()
 define void @new() {
-  ;; Attribute cold converted to hot_cold_t value 0 (coldest).
-  ; HOTCOLD: @_Znwm10hot_cold_t(i64 10, i8 0)
+  ;; Attribute cold converted to __hot_cold_t value 0 (coldest).
+  ; HOTCOLD: @_Znwm12__hot_cold_t(i64 10, i8 0)
   %call = call ptr @_Znwm(i64 10) #0
   call void @dummy(ptr %call)
   ;; Attribute notcold has no effect.
   ; HOTCOLD: @_Znwm(i64 10)
   %call1 = call ptr @_Znwm(i64 10) #1
   call void @dummy(ptr %call1)
-  ;; Attribute hot converted to hot_cold_t value 255 (-1) (hottest).
-  ; HOTCOLD: @_Znwm10hot_cold_t(i64 10, i8 -1)
+  ;; Attribute hot converted to __hot_cold_t value 255 (-1) (hottest).
+  ; HOTCOLD: @_Znwm12__hot_cold_t(i64 10, i8 -1)
   %call2 = call ptr @_Znwm(i64 10) #2
   call void @dummy(ptr %call2)
   ret void
 }
 
 ;; Check that operator new(unsigned long, std::align_val_t) converted to
-;; operator new(unsigned long, std::align_val_t, hot_cold_t) with a hot or
+;; operator new(unsigned long, std::align_val_t, __hot_cold_t) with a hot or
 ;; cold attribute.
 ; HOTCOLD-LABEL: @new_align()
 define void @new_align() {
-  ;; Attribute cold converted to hot_cold_t value 0 (coldest).
-  ; HOTCOLD: @_ZnwmSt11align_val_t10hot_cold_t(i64 10, i64 8, i8 0)
+  ;; Attribute cold converted to __hot_cold_t value 0 (coldest).
+  ; HOTCOLD: @_ZnwmSt11align_val_t12__hot_cold_t(i64 10, i64 8, i8 0)
   %call = call ptr @_ZnwmSt11align_val_t(i64 10, i64 8) #0
   call void @dummy(ptr %call)
   ;; Attribute notcold has no effect.
   ; HOTCOLD: @_ZnwmSt11align_val_t(i64 10, i64 8)
   %call1 = call ptr @_ZnwmSt11align_val_t(i64 10, i64 8) #1
   call void @dummy(ptr %call1)
-  ;; Attribute hot converted to hot_cold_t value 255 (-1) (hottest).
-  ; HOTCOLD: @_ZnwmSt11align_val_t10hot_cold_t(i64 10, i64 8, i8 -1)
+  ;; Attribute hot converted to __hot_cold_t value 255 (-1) (hottest).
+  ; HOTCOLD: @_ZnwmSt11align_val_t12__hot_cold_t(i64 10, i64 8, i8 -1)
   %call2 = call ptr @_ZnwmSt11align_val_t(i64 10, i64 8) #2
   call void @dummy(ptr %call2)
   ret void
 }
 
 ;; Check that operator new(unsigned long, const std::nothrow_t&) converted to
-;; operator new(unsigned long, const std::nothrow_t&, hot_cold_t) with a hot or
+;; operator new(unsigned long, const std::nothrow_t&, __hot_cold_t) with a hot or
 ;; cold attribute.
 ; HOTCOLD-LABEL: @new_nothrow()
 define void @new_nothrow() {
   %nt = alloca i8
-  ;; Attribute cold converted to hot_cold_t value 0 (coldest).
-  ; HOTCOLD: @_ZnwmRKSt9nothrow_t10hot_cold_t(i64 10, ptr nonnull %nt, i8 0)
+  ;; Attribute cold converted to __hot_cold_t value 0 (coldest).
+  ; HOTCOLD: @_ZnwmRKSt9nothrow_t12__hot_cold_t(i64 10, ptr nonnull %nt, i8 0)
   %call = call ptr @_ZnwmRKSt9nothrow_t(i64 10, ptr %nt) #0
   call void @dummy(ptr %call)
   ;; Attribute notcold has no effect.
   ; HOTCOLD: @_ZnwmRKSt9nothrow_t(i64 10, ptr nonnull %nt)
   %call1 = call ptr @_ZnwmRKSt9nothrow_t(i64 10, ptr %nt) #1
   call void @dummy(ptr %call1)
-  ;; Attribute hot converted to hot_cold_t value 255 (-1) (hottest).
-  ; HOTCOLD: @_ZnwmRKSt9nothrow_t10hot_cold_t(i64 10, ptr nonnull %nt, i8 -1)
+  ;; Attribute hot converted to __hot_cold_t value 255 (-1) (hottest).
+  ; HOTCOLD: @_ZnwmRKSt9nothrow_t12__hot_cold_t(i64 10, ptr nonnull %nt, i8 -1)
   %call2 = call ptr @_ZnwmRKSt9nothrow_t(i64 10, ptr %nt) #2
   call void @dummy(ptr %call2)
   ret void
@@ -63,81 +63,81 @@ define void @new_nothrow() {
 
 ;; Check that operator new(unsigned long, std::align_val_t, const std::nothrow_t&)
 ;; converted to
-;; operator new(unsigned long, std::align_val_t, const std::nothrow_t&, hot_cold_t)
+;; operator new(unsigned long, std::align_val_t, const std::nothrow_t&, __hot_cold_t)
 ;; with a hot or cold attribute.
 ; HOTCOLD-LABEL: @new_align_nothrow()
 define void @new_align_nothrow() {
   %nt = alloca i8
-  ;; Attribute cold converted to hot_cold_t value 0 (coldest).
-  ; HOTCOLD: @_ZnwmSt11align_val_tRKSt9nothrow_t10hot_cold_t(i64 10, i64 8, ptr nonnull %nt, i8 0)
+  ;; Attribute cold converted to __hot_cold_t value 0 (coldest).
+  ; HOTCOLD: @_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t(i64 10, i64 8, ptr nonnull %nt, i8 0)
   %call = call ptr @_ZnwmSt11align_val_tRKSt9nothrow_t(i64 10, i64 8, ptr %nt) #0
   call void @dummy(ptr %call)
   ;; Attribute notcold has no effect.
   ; HOTCOLD: @_ZnwmSt11align_val_tRKSt9nothrow_t(i64 10, i64 8, ptr nonnull %nt)
   %call1 = call ptr @_ZnwmSt11align_val_tRKSt9nothrow_t(i64 10, i64 8, ptr %nt) #1
   call void @dummy(ptr %call1)
-  ;; Attribute hot converted to hot_cold_t value 255 (-1) (hottest).
-  ; HOTCOLD: @_ZnwmSt11align_val_tRKSt9nothrow_t10hot_cold_t(i64 10, i64 8, ptr nonnull %nt, i8 -1)
+  ;; Attribute hot converted to __hot_cold_t value 255 (-1) (hottest).
+  ; HOTCOLD: @_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t(i64 10, i64 8, ptr nonnull %nt, i8 -1)
   %call2 = call ptr @_ZnwmSt11align_val_tRKSt9nothrow_t(i64 10, i64 8, ptr %nt) #2
   call void @dummy(ptr %call2)
   ret void
 }
 
 ;; Check that operator new[](unsigned long) converted to
-;; operator new[](unsigned long, hot_cold_t) with a hot or cold attribute.
+;; operator new[](unsigned long, __hot_cold_t) with a hot or cold attribute.
 ; HOTCOLD-LABEL: @array_new()
 define void @array_new() {
-  ;; Attribute cold converted to hot_cold_t value 0 (coldest).
-  ; HOTCOLD: @_Znam10hot_cold_t(i64 10, i8 0)
+  ;; Attribute cold converted to __hot_cold_t value 0 (coldest).
+  ; HOTCOLD: @_Znam12__hot_cold_t(i64 10, i8 0)
   %call = call ptr @_Znam(i64 10) #0
   call void @dummy(ptr %call)
   ;; Attribute notcold has no effect.
   ; HOTCOLD: @_Znam(i64 10)
   %call1 = call ptr @_Znam(i64 10) #1
   call void @dummy(ptr %call1)
-  ;; Attribute hot converted to hot_cold_t value 255 (-1) (hottest).
-  ; HOTCOLD: @_Znam10hot_cold_t(i64 10, i8 -1)
+  ;; Attribute hot converted to __hot_cold_t value 255 (-1) (hottest).
+  ; HOTCOLD: @_Znam12__hot_cold_t(i64 10, i8 -1)
   %call2 = call ptr @_Znam(i64 10) #2
   call void @dummy(ptr %call2)
   ret void
 }
 
 ;; Check that operator new[](unsigned long, std::align_val_t) converted to
-;; operator new[](unsigned long, std::align_val_t, hot_cold_t) with a hot or
+;; operator new[](unsigned long, std::align_val_t, __hot_cold_t) with a hot or
 ;; cold attribute.
 ; HOTCOLD-LABEL: @array_new_align()
 define void @array_new_align() {
-  ;; Attribute cold converted to hot_cold_t value 0 (coldest).
-  ; HOTCOLD: @_ZnamSt11align_val_t10hot_cold_t(i64 10, i64 8, i8 0)
+  ;; Attribute cold converted to __hot_cold_t value 0 (coldest).
+  ; HOTCOLD: @_ZnamSt11align_val_t12__hot_cold_t(i64 10, i64 8, i8 0)
   %call = call ptr @_ZnamSt11align_val_t(i64 10, i64 8) #0
   call void @dummy(ptr %call)
   ;; Attribute notcold has no effect.
   ; HOTCOLD: @_ZnamSt11align_val_t(i64 10, i64 8)
   %call1 = call ptr @_ZnamSt11align_val_t(i64 10, i64 8) #1
   call void @dummy(ptr %call1)
-  ;; Attribute hot converted to hot_cold_t value 255 (-1) (hottest).
-  ; HOTCOLD: @_ZnamSt11align_val_t10hot_cold_t(i64 10, i64 8, i8 -1)
+  ;; Attribute hot converted to __hot_cold_t value 255 (-1) (hottest).
+  ; HOTCOLD: @_ZnamSt11align_val_t12__hot_cold_t(i64 10, i64 8, i8 -1)
   %call2 = call ptr @_ZnamSt11align_val_t(i64 10, i64 8) #2
   call void @dummy(ptr %call2)
   ret void
 }
 
 ;; Check that operator new[](unsigned long, const std::nothrow_t&) converted to
-;; operator new[](unsigned long, const std::nothrow_t&, hot_cold_t) with a hot or
+;; operator new[](unsigned long, const std::nothrow_t&, __hot_cold_t) with a hot or
 ;; cold attribute.
 ; HOTCOLD-LABEL: @array_new_nothrow()
 define void @array_new_nothrow() {
   %nt = alloca i8
-  ;; Attribute cold converted to hot_cold_t value 0 (coldest).
-  ; HOTCOLD: @_ZnamRKSt9nothrow_t10hot_cold_t(i64 10, ptr nonnull %nt, i8 0)
+  ;; Attribute cold converted to __hot_cold_t value 0 (coldest).
+  ; HOTCOLD: @_ZnamRKSt9nothrow_t12__hot_cold_t(i64 10, ptr nonnull %nt, i8 0)
   %call = call ptr @_ZnamRKSt9nothrow_t(i64 10, ptr %nt) #0
   call void @dummy(ptr %call)
   ;; Attribute notcold has no effect.
   ; HOTCOLD: @_ZnamRKSt9nothrow_t(i64 10, ptr nonnull %nt)
   %call1 = call ptr @_ZnamRKSt9nothrow_t(i64 10, ptr %nt) #1
   call void @dummy(ptr %call1)
-  ;; Attribute hot converted to hot_cold_t value 255 (-1) (hottest).
-  ; HOTCOLD: @_ZnamRKSt9nothrow_t10hot_cold_t(i64 10, ptr nonnull %nt, i8 -1)
+  ;; Attribute hot converted to __hot_cold_t value 255 (-1) (hottest).
+  ; HOTCOLD: @_ZnamRKSt9nothrow_t12__hot_cold_t(i64 10, ptr nonnull %nt, i8 -1)
   %call2 = call ptr @_ZnamRKSt9nothrow_t(i64 10, ptr %nt) #2
   call void @dummy(ptr %call2)
   ret void
@@ -145,21 +145,21 @@ define void @array_new_nothrow() {
 
 ;; Check that operator new[](unsigned long, std::align_val_t, const std::nothrow_t&)
 ;; converted to
-;; operator new[](unsigned long, std::align_val_t, const std::nothrow_t&, hot_cold_t)
+;; operator new[](unsigned long, std::align_val_t, const std::nothrow_t&, __hot_cold_t)
 ;; with a hot or cold attribute.
 ; HOTCOLD-LABEL: @array_new_align_nothrow()
 define void @array_new_align_nothrow() {
   %nt = alloca i8
-  ;; Attribute cold converted to hot_cold_t value 0 (coldest).
-  ; HOTCOLD: @_ZnamSt11align_val_tRKSt9nothrow_t10hot_cold_t(i64 10, i64 8, ptr nonnull %nt, i8 0)
+  ;; Attribute cold converted to __hot_cold_t value 0 (coldest).
+  ; HOTCOLD: @_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t(i64 10, i64 8, ptr nonnull %nt, i8 0)
   %call = call ptr @_ZnamSt11align_val_tRKSt9nothrow_t(i64 10, i64 8, ptr %nt) #0
   call void @dummy(ptr %call)
   ;; Attribute notcold has no effect.
   ; HOTCOLD: @_ZnamSt11align_val_tRKSt9nothrow_t(i64 10, i64 8, ptr nonnull %nt)
   %call1 = call ptr @_ZnamSt11align_val_tRKSt9nothrow_t(i64 10, i64 8, ptr %nt) #1
   call void @dummy(ptr %call1)
-  ;; Attribute hot converted to hot_cold_t value 255 (-1) (hottest).
-  ; HOTCOLD: @_ZnamSt11align_val_tRKSt9nothrow_t10hot_cold_t(i64 10, i64 8, ptr nonnull %nt, i8 -1)
+  ;; Attribute hot converted to __hot_cold_t value 255 (-1) (hottest).
+  ; HOTCOLD: @_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t(i64 10, i64 8, ptr nonnull %nt, i8 -1)
   %call2 = call ptr @_ZnamSt11align_val_tRKSt9nothrow_t(i64 10, i64 8, ptr %nt) #2
   call void @dummy(ptr %call2)
   ret void

diff  --git a/llvm/test/tools/llvm-tli-checker/ps4-tli-check.yaml b/llvm/test/tools/llvm-tli-checker/ps4-tli-check.yaml
index b1d4c1303dc7d..23d3482fb89a7 100644
--- a/llvm/test/tools/llvm-tli-checker/ps4-tli-check.yaml
+++ b/llvm/test/tools/llvm-tli-checker/ps4-tli-check.yaml
@@ -38,7 +38,7 @@
 #
 # WRONG_DETAIL: << TLI yes SDK no : '_ZdaPv' aka operator delete[](void*)
 # WRONG_DETAIL: >> TLI no  SDK yes: '_ZdaPvj' aka operator delete[](void*, unsigned int)
-# WRONG_DETAIL-COUNT-8: << TLI yes SDK no : {{.*}}hot_cold_t
+# WRONG_DETAIL-COUNT-8: << TLI yes SDK no : {{.*}}__hot_cold_t
 # WRONG_SUMMARY: << Total TLI yes SDK no:  9{{$}}
 # WRONG_SUMMARY: >> Total TLI no  SDK yes: 1{{$}}
 # WRONG_SUMMARY: == Total TLI yes SDK yes: 234

diff  --git a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
index 5c47dca605364..b91c2617c5077 100644
--- a/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
+++ b/llvm/unittests/Analysis/TargetLibraryInfoTest.cpp
@@ -433,26 +433,26 @@ TEST_F(TargetLibraryInfoTest, ValidProto) {
       "declare i8* @_ZnajSt11align_val_t(i32, i32)\n"
       "declare i8* @_ZnajSt11align_val_tRKSt9nothrow_t(i32, i32, %struct*)\n"
       "declare i8* @_Znam(i64)\n"
-      "declare i8* @_Znam10hot_cold_t(i64, i8)\n"
+      "declare i8* @_Znam12__hot_cold_t(i64, i8)\n"
       "declare i8* @_ZnamRKSt9nothrow_t(i64, %struct*)\n"
-      "declare i8* @_ZnamRKSt9nothrow_t10hot_cold_t(i64, %struct*, i8)\n"
+      "declare i8* @_ZnamRKSt9nothrow_t12__hot_cold_t(i64, %struct*, i8)\n"
       "declare i8* @_ZnamSt11align_val_t(i64, i64)\n"
-      "declare i8* @_ZnamSt11align_val_t10hot_cold_t(i64, i64, i8)\n"
+      "declare i8* @_ZnamSt11align_val_t12__hot_cold_t(i64, i64, i8)\n"
       "declare i8* @_ZnamSt11align_val_tRKSt9nothrow_t(i64, i64, %struct*)\n"
-      "declare i8* @_ZnamSt11align_val_tRKSt9nothrow_t10hot_cold_t(i64, i64, "
+      "declare i8* @_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t(i64, i64, "
       "%struct*, i8)\n"
       "declare i8* @_Znwj(i32)\n"
       "declare i8* @_ZnwjRKSt9nothrow_t(i32, %struct*)\n"
       "declare i8* @_ZnwjSt11align_val_t(i32, i32)\n"
       "declare i8* @_ZnwjSt11align_val_tRKSt9nothrow_t(i32, i32, %struct*)\n"
       "declare i8* @_Znwm(i64)\n"
-      "declare i8* @_Znwm10hot_cold_t(i64, i8)\n"
+      "declare i8* @_Znwm12__hot_cold_t(i64, i8)\n"
       "declare i8* @_ZnwmRKSt9nothrow_t(i64, %struct*)\n"
-      "declare i8* @_ZnwmRKSt9nothrow_t10hot_cold_t(i64, %struct*, i8)\n"
+      "declare i8* @_ZnwmRKSt9nothrow_t12__hot_cold_t(i64, %struct*, i8)\n"
       "declare i8* @_ZnwmSt11align_val_t(i64, i64)\n"
-      "declare i8* @_ZnwmSt11align_val_t10hot_cold_t(i64, i64, i8)\n"
+      "declare i8* @_ZnwmSt11align_val_t12__hot_cold_t(i64, i64, i8)\n"
       "declare i8* @_ZnwmSt11align_val_tRKSt9nothrow_t(i64, i64, %struct*)\n"
-      "declare i8* @_ZnwmSt11align_val_tRKSt9nothrow_t10hot_cold_t(i64, i64, "
+      "declare i8* @_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t(i64, i64, "
       "%struct*, i8)\n"
 
       "declare void @\"??3 at YAXPEAX@Z\"(i8*)\n"


        


More information about the llvm-commits mailing list