[llvm] [profcheck] Fix profile metadata in IntegerDivision/ExpandIRinsts (PR #173114)

Jin Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 22 11:16:43 PST 2025


================
@@ -235,11 +244,53 @@ static Value *generateUnsignedDivisionCode(Value *Dividend, Value *Divisor,
   Value *Tmp1 = Builder.CreateCall(CTLZ, {Dividend, True});
   Value *SR          = Builder.CreateSub(Tmp0, Tmp1);
   Value *Ret0_4      = Builder.CreateICmpUGT(SR, MSB);
+
+  // Add 'unlikely' branch weights to the select instruction ('Ret0') generated
+  // by 'CreateLogicalOr'. We assume the 'true' path, where either the divisor
+  // or dividend is zero ('Ret0_3'), is less likely than the 'false' path,
+  // which corresponds to the |divisor| > |dividend| ('Ret0_4').
----------------
jinhuang1102 wrote:

Sure. Reworded the comments.

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


More information about the llvm-commits mailing list