[Mlir-commits] [mlir] [mlir][spirv] Add folding for [S|U]Mod, [S|U]Div, SRem (PR #73341)

Jakub Kuderski llvmlistbot at llvm.org
Fri Nov 24 13:25:03 PST 2023


================
@@ -69,6 +69,14 @@ static Attribute extractCompositeElement(Attribute composite,
   return {};
 }
 
+static bool isDivZeroOrOverflow(const APInt &a, const APInt &b) {
+  bool div0 = b.isZero();
+
+  bool overflow = a.isMinSignedValue() && b.isAllOnes();
+
----------------
kuhar wrote:

```suggestion
  bool div0 = b.isZero();
  bool overflow = a.isMinSignedValue() && b.isAllOnes();
```

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


More information about the Mlir-commits mailing list