Yingwei Zheng
287294d54d
[ConstraintElim] Do not allow overflows in Decomposition
(#140541)
Consider the following case:
```
define i1 @pr140481(i32 %x) {
%cond = icmp slt i32 %x, 0
call void @llvm.assume(i1 %cond)
%add = add nsw i32 %x, 5001000
%mul1 = mul nsw i32 %add, -5001000
%mul2 = mul nsw i32 %mul1, 5001000
%cmp2 = icmp sgt i32 %mul2, 0
ret i1 %cmp2
}
```
Before this patch, `decompose(%mul2)` returns `-25010001000000 * %x +
4052193514966861312`.
Therefore, `%cmp2` will be simplified into true because `%x s< 0 &&
-25010001000000 * %x + 4052193514966861312 s<= 0` is unsat.
It is incorrect since the offset `-25010001000000 * 5001000 ->
4052193514966861312` signed wraps.
This patch treats a decomposition as invalid if overflows occur when
computing coefficients.
Closes https://github.com/llvm/llvm-project/issues/140481.
2025-05-22 11:31:04 +08:00
..
2025-04-30 21:46:07 +08:00
2023-12-23 15:53:48 +01:00
2025-02-25 14:22:55 +01:00
2025-05-14 23:37:41 +08:00
2025-05-22 11:31:04 +08:00
2025-05-14 23:37:41 +08:00
2023-12-23 15:53:48 +01:00
2025-05-14 23:37:41 +08:00
2024-12-04 16:27:31 +01:00
2023-12-23 15:53:48 +01:00
2025-05-14 23:37:41 +08:00
2024-11-21 11:21:12 +00:00
2024-11-18 23:41:04 +08:00
2023-12-23 15:53:48 +01:00
2025-05-14 23:37:41 +08:00
2023-12-23 15:53:48 +01:00
2025-05-14 23:37:41 +08:00
2023-12-23 15:53:48 +01:00
2024-02-23 01:16:39 +08:00
2024-01-04 14:04:15 +01:00
2024-01-08 10:00:23 +01:00
2024-09-10 14:45:49 +01:00
2023-12-23 15:53:48 +01:00
2025-01-23 11:00:31 +01:00
2025-05-14 23:37:41 +08:00
2025-05-14 23:37:41 +08:00
2025-01-23 11:00:31 +01:00
2023-12-23 15:53:48 +01:00
2023-12-23 15:53:48 +01:00
2024-02-05 11:57:34 +01:00
2025-05-05 21:08:58 +08:00
2025-05-05 21:08:58 +08:00
2024-02-27 09:25:23 +00:00
2024-05-22 13:11:04 +01:00
2024-01-05 09:53:05 +01:00
2024-12-16 16:41:04 +08:00
2024-01-02 22:05:57 +00:00
2025-02-24 13:07:47 +00:00
2024-05-22 13:11:04 +01:00
2024-12-06 23:15:31 +08:00
2025-04-30 21:49:18 +08:00
2024-01-24 14:25:55 +00:00
2024-07-10 21:59:59 +02:00
2024-11-06 11:53:33 +00:00
2024-02-28 13:14:40 +00:00