[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:16:13 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.
switch (Func) {
+ case LibFunc_Znwm12__hot_cold_t:
+ if (OptimizeExistingHotColdNew)
----------------
teresajohnson wrote:
That would require analyzing the value passed to the existing hot/cold new, and it may not be available in the function scope.
https://github.com/llvm/llvm-project/pull/91047
More information about the llvm-commits
mailing list