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

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 3 13:06:26 PDT 2025


================
@@ -599,6 +601,11 @@ 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 (Instruction *SelectI = dyn_cast<Instruction>(Select))
----------------
mtrofin wrote:

add the check on `ProfcheckDisableMetadataFixes` (so we can do ablation test after)

```
if (!ProfcheckDisableMetadataFixes)
  if (Instruction *SelectI = dyn_cast...)
```

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


More information about the llvm-commits mailing list