[PATCH] D138132: [JumpThreading] Preserve profile metadata during select unfolding

Roman Paukner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 03:12:23 PST 2022


rp added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:2762
   BI->applyMergedLocation(PredTerm->getDebugLoc(), SI->getDebugLoc());
+  BI->copyMetadata(*SI, {LLVMContext::MD_prof});
   SIUse->setIncomingValue(Idx, SI->getFalseValue());
----------------
mkazantsev wrote:
> Should this also be under `HasProfileData`?
The code is not very consistent, for example updatePredecessorProfileMetadata updates MD_prof without checking for HasProfile. 

As IR with MD_prof attached to instruction yet without MD_prof attached to function will pass validation, I've concluded that it would not be polite to just ignore the attribute.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138132/new/

https://reviews.llvm.org/D138132



More information about the llvm-commits mailing list