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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed May 28 05:55:54 PDT 2025


================
@@ -19075,8 +19075,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.
+
+It is undefined behavior if the second argument is zero.
----------------
nikic wrote:

It's possible that for sdiv.fix in particular, the moral equivalent of INT_MIN / -1 may be UB.

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


More information about the llvm-commits mailing list