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

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 8 14:45:46 PDT 2025


================
@@ -599,6 +607,16 @@ 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);
 
+    // The true branch of select handles the cttz(0) case, which is extremely
+    // rare. Use the standard createUnlikelyBranchWeights() helper to provide a
----------------
boomanaiden154 wrote:

Nit: You can probably remove the second sentence given `createUnlikelyBranchWeights` should be self documenting.

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


More information about the llvm-commits mailing list