[llvm] [profcheck] Add unknown branch weight for inlined memchr calls. (PR #160964)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 10:05:44 PDT 2025


================
@@ -1350,6 +1350,11 @@ static bool foldMemChr(CallInst *Call, DomTreeUpdater *DTU,
   BB->getTerminator()->eraseFromParent();
   SwitchInst *SI = IRB.CreateSwitch(
       IRB.CreateTrunc(Call->getArgOperand(1), ByteTy), BBNext, N);
+  Function *F = Call->getFunction();
+  assert(F && "Instruction does not belong to a function!");
----------------
mtrofin wrote:

also, can you add a comment saying that we can't know the precise weights here because it'd depend on knowing the value distribution of `Call->getArgOperand(1)` (if I got that right; just for readability).

Thanks.

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


More information about the llvm-commits mailing list