[llvm] ValueTracking: simplify udiv/urem recurrences (PR #108973)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 05:32:25 PDT 2024


================
@@ -1543,6 +1543,21 @@ static void computeKnownBitsFromOperator(const Operator *I,
         }
         break;
       }
+
+      // Check for operations with the property that the magnitude of the
+      // result will never exceed that of the start value.
+      case Instruction::UDiv:
+      case Instruction::URem: {
----------------
nikic wrote:

Isn't this missing a check for the operand?

(a udiv b) is <= a, but *not* <= b.

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


More information about the llvm-commits mailing list