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

Jin Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 14:18:59 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(
----------------
jinhuang1102 wrote:

You are right! The comment for bias weights is added. Thank you too!

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


More information about the llvm-commits mailing list