[Mlir-commits] [mlir] [mlir][NFC] Simplify constant checks with isZeroIndex and isOneIndex. (PR #139340)

Matthias Springer llvmlistbot at llvm.org
Sun May 11 00:38:45 PDT 2025


================
@@ -18,10 +18,13 @@ namespace mlir {
 bool isZeroIndex(OpFoldResult v) {
   if (!v)
     return false;
-  std::optional<int64_t> constint = getConstantIntValue(v);
-  if (!constint)
+  return isConstantIntValue(v, 0);
+}
+
+bool isOneIndex(OpFoldResult v) {
+  if (!v)
----------------
matthias-springer wrote:

This check is not needed. `isConstantIntValue` already checks for null.


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


More information about the Mlir-commits mailing list