[llvm] [InstCombineCompare] Use known bits to insert assume intrinsics. (PR #96017)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 15:23:41 PDT 2024


================
@@ -6333,6 +6337,125 @@ bool InstCombinerImpl::replacedSelectWithOperand(SelectInst *SI,
   return false;
 }
 
+static void computeClosestIntsSatisfyingKnownBits(
+    APInt Target, KnownBits &Known, unsigned BitWidth, bool IsSigned,
+    APInt &ClosestSmaller, APInt &ClosestBigger) {
+  int KnownZeroMaskLength = BitWidth - Known.Zero.countLeadingZeros();
+  if (KnownZeroMaskLength == 0)
+    return;
+
+  APInt PowOf2(BitWidth, 1 << KnownZeroMaskLength);
----------------
goldsteinn wrote:

`APInt::getOneBitSet(BitWidth, KnownZeroMaskLength)`

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


More information about the llvm-commits mailing list