[llvm] [profcheck] Add heuristical profile metadata for lowering table-based cttz. (PR #161898)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 10:34:32 PDT 2025


================
@@ -599,6 +607,13 @@ static bool tryToRecognizeTableBasedCttz(Instruction &I, const DataLayout &DL) {
     auto Cmp = B.CreateICmpEQ(X1, ConstantInt::get(XType, 0));
     auto Select = B.CreateSelect(Cmp, B.CreateZExt(ZeroTableElem, XType), Cttz);
 
+    if (!ProfcheckDisableMetadataFixes) {
+      if (Instruction *SelectI = dyn_cast<Instruction>(Select))
+        SelectI->setMetadata(
----------------
mtrofin wrote:

last nit (sorry!): can you add a comment above explaining where the numbers come from - basically the gist of the commit message. Saves time to a reader (i.e. rather than finding the commit that introduced this..)

Thanks!

https://github.com/llvm/llvm-project/pull/161898


More information about the llvm-commits mailing list