[llvm] [Support] Adding fast-path for KnownBits's udiv when RHS is constant (PR #189779)

Max Graey via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 03:30:15 PDT 2026


================
@@ -1209,6 +1209,26 @@ KnownBits KnownBits::udiv(const KnownBits &LHS, const KnownBits &RHS,
     return Known;
   }
 
+  if (RHS.isConstant()) {
----------------
MaxGraey wrote:

The problem with `lshr` that `RHS.getConstant().logBase2()` will have to be packed back into `KnownBits`, since we only have `static KnownBits shl(const KnownBits &LHS, const KnownBits &RHS, ...`

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


More information about the llvm-commits mailing list