[Mlir-commits] [mlir] [mlir][arith] doc updates for ub semantics, and int representations (PR #72932)
Mehdi Amini
llvmlistbot at llvm.org
Tue Nov 21 22:58:56 PST 2023
================
@@ -198,7 +198,9 @@ def Arith_AddIOp : Arith_TotalIntBinaryOp<"addi", [Commutative]> {
The `addi` operation takes two operands and returns one result, each of
these is required to be the same type. This type may be an integer scalar
type, a vector whose element type is integer, or a tensor of integers. It
- has no standard attributes.
+ has no standard attributes. If an overflow occurs, the result is the
+ mathematical value of the addition modulo 2^n, where `n` is the width of
+ the integer type.
----------------
joker-eph wrote:
> It's been implicitly defined through all the lowering paths and existing transforms that depend on it. This just documents the state of the world.
I don't think so: we could define it as UB (or "implementation defined") with just the exact same claim of "this just documents the state of the world". Our current implementation decides to not take advantage of something does not mean the same thing as "we commit to this behavior".
https://github.com/llvm/llvm-project/pull/72932
More information about the Mlir-commits
mailing list