[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 07:04:27 PDT 2025


================
@@ -18819,8 +18819,8 @@ 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.
+If the result value does not fit within the range of the fixed point type, the
----------------
lukel97 wrote:

I think I saw some constant folding in there somewhere, i.e. `call i8 @llvm.smul.fix(i8 126, i8 126, i32 1)` gets simplified to `2`. But that should be 63*63 which should be greater than 2^6? So I guess that should be poison but we're not detecting the overflow currently.

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


More information about the llvm-commits mailing list