[llvm] [MemProf] Optionally update hints on existing hot/cold new calls (PR #91047)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 13:18:36 PDT 2024
================
@@ -1722,45 +1730,118 @@ Value *LibCallSimplifier::optimizeNew(CallInst *CI, IRBuilderBase &B,
uint8_t HotCold;
if (CI->getAttributes().getFnAttr("memprof").getValueAsString() == "cold")
HotCold = ColdNewHintValue;
+ else if (CI->getAttributes().getFnAttr("memprof").getValueAsString() ==
+ "notcold")
+ HotCold = NotColdNewHintValue;
else if (CI->getAttributes().getFnAttr("memprof").getValueAsString() == "hot")
HotCold = HotNewHintValue;
else
return nullptr;
+ // For calls that already pass a hot/cold hint, only update the hint if
+ // directed by OptimizeExistingHotColdNew. For other calls to new, add a hint
+ // if cold or hot, and leave as-is for default handling if "notcold" aka warm.
----------------
teresajohnson wrote:
> there should be a slight performance advantage to delegate to an unhinted variant rather than passing in the new hinted value
I might be missing something, but why would that be? Afaik tcmalloc should treat something with the default notcold hint value the same as anything else that isn't cold hinted. Or are you just talking about the need for the allocator to check the hint value being passed in?
https://github.com/llvm/llvm-project/pull/91047
More information about the llvm-commits
mailing list