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

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 06:59:44 PDT 2024


================
@@ -1543,6 +1543,29 @@ static void computeKnownBitsFromOperator(const Operator *I,
         }
         break;
       }
+
+      case Instruction::UDiv: {
+        // For UDiv, the result can never exceed either the numerator, or the
+        // start value, whichever is greater. The case where the PHI is not
+        // the numerator of the UDiv is already handled by other code.
+        if (BO->getOperand(0) != P)
+          break;
+        [[fallthrough]];
+      }
+
----------------
goldsteinn wrote:

No need to create a scope for `UDiv` case.

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


More information about the llvm-commits mailing list