[llvm] [IR] Specify that overflow is poison, not UB in {s,u}{mul,div}.fix (PR #141748)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 06:53:47 PDT 2025


================
@@ -19135,8 +19137,10 @@ If the result value cannot be precisely represented in the given scale, the
 value is rounded up or down to the closest representable value. The rounding
 direction is unspecified.
 
-It is undefined behavior if the result value does not fit within the range of
-the fixed point type, or if the second argument is zero.
+If the result value does not fit within the range of the fixed point type, the
+result is poison.
----------------
lukel97 wrote:

Can it overflow if you divide by a fractional value? e.g. i8 udiv.fix(i8 255, i8 1, i8 1) = 127.5 / 0.5 = 255, which > 127.5?

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


More information about the llvm-commits mailing list