[Mlir-commits] [mlir] [mlir][arith] Check overflow when reassociating integer constants (PR #233155)
Krzysztof Drewniak
llvmlistbot at llvm.org
Sun Oct 18 21:19:57 PDT 2026
================
@@ -42,9 +42,20 @@ def OrIntAttrs : NativeCodeCall<"orIntegerAttrs($_builder, $0, $1, $2)">;
// Bitwise-xor two integer attributes and create a new one with the result.
def XorIntAttrs : NativeCodeCall<"xorIntegerAttrs($_builder, $0, $1, $2)">;
-// Merge overflow flags from 2 ops, selecting the most conservative combination.
+// Intersect overflow flags. Callers must ensure the common flags remain valid
+// after rewriting.
def MergeOverflow : NativeCodeCall<"mergeOverflowFlags($0, $1)">;
+// For fixed-width integers, retain common flags only if the constant arithmetic
+// does not overflow in their respective signedness. Pass constants in folding
+// order.
+class MergeOverflowForReassociation<string op> : NativeCodeCall<
----------------
krzysz00 wrote:
Huh, that's a clever construct
https://github.com/llvm/llvm-project/pull/233155
More information about the Mlir-commits
mailing list