[llvm] [MemProf] Optionally update hints on existing hot/cold new calls (PR #91047)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 16:19:40 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.
----------------
snehasish wrote:
If an existing hinted allocation is to be marked with a notcold hint, there should be a slight performance advantage to delegate to an unhinted variant rather than passing in the new hinted value. It's not a very important use case right now but perhaps worth noting in the comment?
https://github.com/llvm/llvm-project/pull/91047
More information about the llvm-commits
mailing list